Leon 16669b4efb update | 6 vuotta sitten | |
---|---|---|
.idea | 6 vuotta sitten | |
src | 6 vuotta sitten | |
target | 6 vuotta sitten | |
README.md | 6 vuotta sitten | |
pom.xml | 6 vuotta sitten | |
quiz3.iml | 6 vuotta sitten |
a
and b
write a method compare(a, b)
that returns true if 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.a = [121, 144, 19, 161, 19, 144, 19, 11]
b = [121, 14641, 20736, 361, 25921, 361, 20736, 361]
compare(a, b)
returns true because in b
a = [121, 144, 19, 161, 19, 144, 19, 11]
b = [132, 14641, 20736, 361, 25921, 361, 20736, 361]
compare(a,b)
returns false
because in b
132 is not the square of any number of a
.
a = [121, 144, 19, 161, 19, 144, 19, 11]
b = [121, 14641, 20736, 36100, 25921, 361, 20736, 361]
comp(a,b)
returns false
because in b
36100 is not the square of any number of a
.