Leon 16669b4efb update | 6 gadus atpakaļ | |
---|---|---|
.idea | 6 gadus atpakaļ | |
src | 6 gadus atpakaļ | |
target | 6 gadus atpakaļ | |
README.md | 6 gadus atpakaļ | |
pom.xml | 6 gadus atpakaļ | |
quiz3.iml | 6 gadus atpakaļ |
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
.