title: Find The Maximum Subarray Xor In A Given Array
signature: fun findTheMaximumSubarrayXorInAGivenArray(arr: ArrayList<Int>, n: Int): Int {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": 63, "inputs": {"arr": [1, 7, 7, 11, 12, 18, 20, 23, 27, 30, 44, 47, 53, 53, 55, 57, 57, 58, 61, 62, 67, 74, 76, 80, 86, 86], "n": 13}}, {"idx": 1, "outputs": 126, "inputs": {"arr": [-34, -4, 68, -82, 54, 20, 6, -18, -70, 98, -40, 80, -28, 78, 28, 56, 26, 2, 2, -56, -66, 44, 0, -72, 12, 54, -40, 18, 28, -48, -56, 72, 84, 60, 76, 26, -8, 62], "n": 21}}, {"idx": 2, "outputs": 1, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 12}}, {"idx": 3, "outputs": 33, "inputs": {"arr": [33, 98], "n": 1}}, {"idx": 4, "outputs": 126, "inputs": {"arr": [-92, -80, -76, -76, -74, -58, -44, -38, -34, -32, -30, -24, -20, -18, -4, -2, 2, 8, 44, 52, 52, 56, 70, 72, 80, 80, 98], "n": 15}}, {"idx": 5, "outputs": 1, "inputs": {"arr": [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0], "n": 33}}, {"idx": 6, "outputs": 127, "inputs": {"arr": [1, 2, 3, 6, 9, 15, 15, 18, 19, 25, 31, 31, 33, 37, 39, 47, 49, 51, 51, 52, 52, 54, 58, 59, 59, 61, 62, 62, 65, 66, 66, 66, 66, 67, 71, 76, 77, 78, 79, 80, 83, 86, 87, 92, 97, 97, 98, 99], "n": 38}}, {"idx": 7, "outputs": 126, "inputs": {"arr": [34, -90, 64, 88, -46, -4, -96, 76, -32, 10, -8, -24, 32, -4, 86, -20, -86, -88, -72, 64, 12, 66, -96, -84, 16, -58, -48, 80, -80, 70, -94, -84, 56, 8, -14, 86, 72, -16, -18, 74, 40, 34, 20, 80], "n": 35}}, {"idx": 8, "outputs": 1, "inputs": {"arr": [1, 1], "n": 1}}, {"idx": 9, "outputs": 127, "inputs": {"arr": [57, 76, 2, 30, 24, 12, 49, 12, 5, 75, 55, 17, 62, 87, 21, 91, 88, 10, 20, 49, 46, 79, 51, 33, 94, 59, 48, 97, 70, 49], "n": 25}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(1, 7, 7, 11, 12, 18, 20, 23, 27, 30, 44, 47, 53, 53, 55, 57, 57, 58, 61, 62, 67, 74, 76, 80, 86, 86), 13, 63)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(-34, -4, 68, -82, 54, 20, 6, -18, -70, 98, -40, 80, -28, 78, 28, 56, 26, 2, 2, -56, -66, 44, 0, -72, 12, 54, -40, 18, 28, -48, -56, 72, 84, 60, 76, 26, -8, 62), 21, 126)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 12, 1)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(33, 98), 1, 33)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-92, -80, -76, -76, -74, -58, -44, -38, -34, -32, -30, -24, -20, -18, -4, -2, 2, 8, 44, 52, 52, 56, 70, 72, 80, 80, 98), 15, 126)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0), 33, 1)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(1, 2, 3, 6, 9, 15, 15, 18, 19, 25, 31, 31, 33, 37, 39, 47, 49, 51, 51, 52, 52, 54, 58, 59, 59, 61, 62, 62, 65, 66, 66, 66, 66, 67, 71, 76, 77, 78, 79, 80, 83, 86, 87, 92, 97, 97, 98, 99), 38, 127)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(34, -90, 64, 88, -46, -4, -96, 76, -32, 10, -8, -24, 32, -4, 86, -20, -86, -88, -72, 64, 12, 66, -96, -84, 16, -58, -48, 80, -80, 70, -94, -84, 56, 8, -14, 86, 72, -16, -18, 74, 40, 34, 20, 80), 35, 126)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(1, 1), 1, 1)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(57, 76, 2, 30, 24, 12, 49, 12, 5, 75, 55, 17, 62, 87, 21, 91, 88, 10, 20, 49, 46, 79, 51, 33, 94, 59, 48, 97, 70, 49), 25, 127)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: findTheMaximumSubarrayXorInAGivenArray
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn