[코딩테스트] Are they the "same"?


[코딩테스트] Are they the "same"?

Are they the "same"?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.Examples :Valid arraysa = [121, 144, 19, 161, 19, 144, 19, 11]b = [121, 14641, 20736, 361, 25921, 361, 20736, 361]comp(a, b) returns true because in b 121 is the square of 11, 14641 is the square of 121, 20736 the square of 144, 361 the square of 19, 25921 the square o..........



원문링크 : [코딩테스트] Are they the "same"?