小编Geo*_*ine的帖子

Are they the "same"? CodeWars

HERE IS THE FULL QUESTION DESCRIPTION

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 arrays

a = [121, 144, 19, 161, 19, 144, 19, 11]  
b = [121, 14641, 20736, 361, 25921, 361, 20736, 361]
Run Code Online (Sandbox Code Playgroud)

comp(a, b) returns true …

javascript arrays debugging compare

0
推荐指数
1
解决办法
2332
查看次数

标签 统计

arrays ×1

compare ×1

debugging ×1

javascript ×1