title: Find The Maximum Subarray Xor In A Given Array
signature: find_the_maximum_subarray_xor_in_a_given_array <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(1L, 7L, 7L, 11L, 12L, 18L, 20L, 23L, 27L, 30L, 44L, 47L, 53L, 53L, 55L, 57L, 57L, 58L, 61L, 62L, 67L, 74L, 76L, 80L, 86L, 86L), 13L, 
          63L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-34L, -4L, 68L, -82L, 54L, 20L, 6L, -18L, -70L, 98L, -40L, 80L, -28L, 78L, 28L, 56L, 26L, 2L, 2L, -56L, -66L, 44L, 0L, -72L, 12L, 54L, -40L, 18L, 28L, -48L, -56L, 72L, 84L, 60L, 76L, 26L, -8L, 62L), 21L, 
          126L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 12L, 
          1L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(33L, 98L), 1L, 
          33L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-92L, -80L, -76L, -76L, -74L, -58L, -44L, -38L, -34L, -32L, -30L, -24L, -20L, -18L, -4L, -2L, 2L, 8L, 44L, 52L, 52L, 56L, 70L, 72L, 80L, 80L, 98L), 15L, 
          126L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L), 33L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 2L, 3L, 6L, 9L, 15L, 15L, 18L, 19L, 25L, 31L, 31L, 33L, 37L, 39L, 47L, 49L, 51L, 51L, 52L, 52L, 54L, 58L, 59L, 59L, 61L, 62L, 62L, 65L, 66L, 66L, 66L, 66L, 67L, 71L, 76L, 77L, 78L, 79L, 80L, 83L, 86L, 87L, 92L, 97L, 97L, 98L, 99L), 38L, 
          127L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(34L, -90L, 64L, 88L, -46L, -4L, -96L, 76L, -32L, 10L, -8L, -24L, 32L, -4L, 86L, -20L, -86L, -88L, -72L, 64L, 12L, 66L, -96L, -84L, 16L, -58L, -48L, 80L, -80L, 70L, -94L, -84L, 56L, 8L, -14L, 86L, 72L, -16L, -18L, 74L, 40L, 34L, 20L, 80L), 35L, 
          126L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(1L, 1L), 1L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(57L, 76L, 2L, 30L, 24L, 12L, 49L, 12L, 5L, 75L, 55L, 17L, 62L, 87L, 21L, 91L, 88L, 10L, 20L, 49L, 46L, 79L, 51L, 33L, 94L, 59L, 48L, 97L, 70L, 49L), 25L, 
          127L
      )))
  
  }
  
  main()
source_py: def find_the_maximum_subarray_xor_in_a_given_array(arr, n):
      ans = (- 2147483648)
      for i in range(n):
          curr_xor = 0
          for j in range(i, n):
              curr_xor = (curr_xor ^ arr[j])
              ans = max(ans, curr_xor)
      return ans
source_cpp: int find_the_maximum_subarray_xor_in_a_given_array(vector<int> arr, int n) {
    int ans = INT_MIN;
    for ( int i = 0;
    i < n;
    i ++ ) {
      int curr_xor = 0;
      for ( int j = i;
      j < n;
      j ++ ) {
        curr_xor = curr_xor ^ arr [ j ];
        ans = max ( ans, curr_xor );
      }
    }
    return ans;
  }