Maximize the largest number K such that bitwise and of K till N is 0 | package whatever do not write package name here ; Function to find maximum value of k which makes bitwise AND zero . ; Finding the power less than N ; Driver Code
using System ; class GFG { static int findMaxK ( int N ) { int p = ( int ) ( Math . Log ( N ) / Math . Log ( 2 ) ) ; return ( int ) Math . Pow ( 2 , p ) ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( findMaxK ( N ) - 1 ) ; } }