Maximize the largest number K such that bitwise and of K till N is 0 | Function to find maximum value of k which makes bitwise AND zero . ; Finding the power less than N ; Driver Code
function findMaxK ( N ) { var p = Math . log ( N ) / Math . log ( 2 ) ; return parseInt ( Math . pow ( 2 , p ) ) ; } var N = 5 ; document . write ( findMaxK ( N ) - 1 ) ;