Maximum XOR | Python3 program to obtain maximum XOR value sub - array ; Function to calculate maximum XOR value ; Return ( 2 ^ c - 1 ) ; Driver Code
import math NEW_LINE def maxXOR ( n , k ) : NEW_LINE INDENT c = int ( math . log ( n , 2 ) ) + 1 NEW_LINE return ( ( 1 << c ) - 1 ) NEW_LINE DEDENT n = 12 ; k = 3 NEW_LINE print ( maxXOR ( n , k ) ) NEW_LINE