Leon 8bf0dff8b6 update | 6 jaren geleden | |
---|---|---|
.idea | 6 jaren geleden | |
src | 6 jaren geleden | |
target | 6 jaren geleden | |
.gitignore | 6 jaren geleden | |
README.md | 6 jaren geleden | |
pom.xml | 6 jaren geleden | |
quiz3.iml | 6 jaren geleden |
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
.