the frequency of prime factors in a perfect square is always even. you can find that if you do some paperwork or generate prime factors for a few numbers.

Let an array arr[i] has the list of prime factors of Ai. so, for the product of the given array, we can count how many times every prime factors occur in the given array. if any prime factor occurs odd number of times the answer is NO.

Contributors

Statistics

39% Solution Ratio
NAbdullaEarliest, Apr '19
UITS_NewbiesFastest, 0.0s
UITS_NewbiesLightest, 5.5 kB
Marzuq01Shortest, 226B
Toph uses cookies. By continuing you agree to our Cookie Policy.