Paste Search Dynamic
Recent pastes
xorOfArray
  1. def xorOfArray(arr, n):
  2.         maxi=0
  3.         for i in range(n):
  4.                 xor = arr[i]
  5.                 arr[0] = arr[0]&(arr[0]^xor)
  6.                 res=arr[0]
  7.                 for j in range(1,n):
  8.                         res=res^arr[i]
  9.                 maxi=max(res,maxi)
  10.         return maxi
  11.  
  12. # Driver Code
  13. if __name__ == '__main__':
  14.     arr = [6,6,0,1,7,7,1]
  15.     n = len(arr)
  16.  
  17.     # Function call
  18.     print(xorOfArray(arr, n))
  19.  
  20. # This code is contributed by mohit kumar 29
Parsed in 0.002 seconds