Given a number N.Find the nearest number which is a power of 2 and greater than or equal to N.
N = 1
The nearest power of 2 greater than or
equal to 1 is 2^0=1.
N = 5
The nearest power of 2 greater than 5 is
You don't need to read input or print anything.Your Task is to complete the function nearestPowerOf2() which takes a number N as input parameter and returns the nearest power of 2 that is greater than or equal to N.
Expected Time Complexity:O(LogN) Expected Auxillary Space:O(1)