Check whether the product of every subsequence is a perfect square or not | Function to check if the product of every subsequence of the array is a perfect square or not ; Traverse the given array ; If arr [ i ] is a perfect square or not ; Return " Yes " ; Driver Code
function perfectSquare ( arr , N ) { for ( let i = 0 ; i < N ; i ++ ) { let p = Math . sqrt ( arr [ i ] ) ; if ( p * p != arr [ i ] ) { return " " ; } } return " " ; } let arr = [ 1 , 4 , 100 ] ; let N = arr . length ; document . write ( perfectSquare ( arr , N ) ) ;