Company: Palo Alto Networks SDE on campus_16march
Difficulty: medium
You're given an integer array A of size N . Carry out the following steps, in order: Replace every element of A with its own square. Write out the binary form of each element in the updated array. Count the set bits (the 1s) in each of those binary values. Among the updated array's elements (in decimal), find X , the one with the most set bits, and Y , the one with the fewest set bits. Multiply X and Y together. Return the smallest power of 2 that is greater than or equal to the product of X and Y. Note: The number of set bits means the number of 1's in a binary value. If two or more numbers have the same number of set bits, then the number with the lower decimal value is considered. A number that is a power of 2 can be expressed as 2 n , where 'n' is a positive integer. Input Specification: input1 : An integer value N, representing the size of the array A. input2 : An integer array A. Output Specification: Return an integer value representing the nearest number which is a power of 2 t