Leon 8bf0dff8b6 update | пре 6 година | |
---|---|---|
.idea | пре 6 година | |
src | пре 6 година | |
target | пре 6 година | |
.gitignore | пре 6 година | |
README.md | пре 6 година | |
pom.xml | пре 6 година | |
quiz3.iml | пре 6 година |
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
.