codewars
-
[Codewars] 6kyu Are they the "same"? (JAVA)IT/개발 기록 2019. 1. 23. 00:18
문제 Given two arrays a and b write a function comp(a, b) (compSame(a, b) in Clojure) that checks whether the two arrays have the "same" elements, with the same multiplicities. "Same" means, here, that the elements in b are the elements in a squared, regardless of the order. 예제 Valid arrays a = [121, 144, 19, 161, 19, 144, 19, 11] b = [121, 14641, 20736, 361, 25921, 361, 20736, 361] comp(a, b) ret..
-
[Codewars] 7kyu Descending Order (JAVA)IT/개발 기록 2019. 1. 16. 12:30
문제 Your task is to make a function that can take any non-negative integer as a argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number. 예제 Input: 21445 Output: 54421 Input: 145263 Output: 654321 Input: 1254859723 Output: 9875543221 코드1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 public static int sortDesc(final in..