text: Split an array into subarrays with maximum Bitwise XOR of their respective Bitwise OR values | C # program for the above approach ; Function to find the bitwise OR of array elements ; Stores the resultant maximum value of Bitwise XOR ; Traverse the array arr [ ] ; Return the maximum value res ; Driver code
code: using System ; class GFG { static int MaxXOR ( int [ ] arr , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { res |= arr [ i ] ; } return res ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 7 } ; int N = arr . Length ; Console . Write ( MaxXOR ( arr , N ) ) ; } }