title: Check If All The Elements Can Be Made Of Same Parity By Inverting Adjacent Elements
signature: fun checkIfAllTheElementsCanBeMadeOfSameParityByInvertingAdjacentElements(a: ArrayList<Int>, n: Int): Boolean {
source_py: def check_if_all_the_elements_can_be_made_of_same_parity_by_inverting_adjacent_elements(a, n):
      count_odd = 0
      count_even = 0
      for i in range(n):
          if (a[i] & 1):
              count_odd += 1
          else:
              count_even += 1
      if ((count_odd % 2) and (count_even % 2)):
          return False
      else:
          return True
source_cpp: bool check_if_all_the_elements_can_be_made_of_same_parity_by_inverting_adjacent_elements(vector<int> a, int n) {
    int count_odd = 0, count_even = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( a [ i ] & 1 ) count_odd ++;
      else count_even ++;
    }
    if ( count_odd % 2 && count_even % 2 ) return false;
    else return true;
  }
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"a": [1, 1, 1, 7, 7, 8, 10, 10, 10, 14, 15, 18, 20, 23, 24, 24, 26, 30, 32, 32, 33, 36, 42, 43, 46, 48, 51, 51, 52, 53, 58, 58, 59, 59, 59, 60, 67, 71, 72, 74, 76, 77, 83, 84, 86, 90, 91], "n": 30}}, {"idx": 1, "outputs": true, "inputs": {"a": [-90, -20, -60, -64, -24, 84, -2, -32, 28, -54, 44, -96, 52, 88, 20, -56, -2], "n": 12}}, {"idx": 2, "outputs": false, "inputs": {"a": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 36}}, {"idx": 3, "outputs": true, "inputs": {"a": [98, 70, 24, 18, 7, 4, 78, 19, 70, 56, 99, 54, 69, 15, 88, 20, 40, 13, 19, 56, 62], "n": 19}}, {"idx": 4, "outputs": true, "inputs": {"a": [-72, -66, -58, -20, 36, 80, 92], "n": 6}}, {"idx": 5, "outputs": true, "inputs": {"a": [0, 1], "n": 1}}, {"idx": 6, "outputs": true, "inputs": {"a": [6, 13, 14, 16, 21, 26, 26, 28, 29, 35, 38, 42, 47, 47, 62, 67, 77, 81, 81, 83, 84, 88, 90, 96, 97, 98], "n": 17}}, {"idx": 7, "outputs": true, "inputs": {"a": [-48, -8, 20, 32, -90, -42, -6, -88, -72, 42, 66, -62, 82, -4, 8, 12, -22, 82, 56, 96, -54, 92, -42, 30, -18, 14, -6, -66, 34, 16, -84, -94, 48, -48, 52, -60, -92, -16], "n": 35}}, {"idx": 8, "outputs": true, "inputs": {"a": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 14}}, {"idx": 9, "outputs": true, "inputs": {"a": [45, 86, 53, 80, 27, 45, 1, 85, 91, 93, 92, 43, 75, 86, 81, 48, 21, 34, 5, 10, 88, 42, 7, 15, 96, 85, 62, 86, 52, 37], "n": 29}}]
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:Boolean, expected:Boolean):Boolean{
    return actual.equals(expected)
  }
  fun driver(a: ArrayList<Int>, n: Int, expected:Boolean):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(a, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(1, 1, 1, 7, 7, 8, 10, 10, 10, 14, 15, 18, 20, 23, 24, 24, 26, 30, 32, 32, 33, 36, 42, 43, 46, 48, 51, 51, 52, 53, 58, 58, 59, 59, 59, 60, 67, 71, 72, 74, 76, 77, 83, 84, 86, 90, 91), 30, true)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(-90, -20, -60, -64, -24, 84, -2, -32, 28, -54, 44, -96, 52, 88, 20, -56, -2), 12, true)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 36, false)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(98, 70, 24, 18, 7, 4, 78, 19, 70, 56, 99, 54, 69, 15, 88, 20, 40, 13, 19, 56, 62), 19, true)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-72, -66, -58, -20, 36, 80, 92), 6, true)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(0, 1), 1, true)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(6, 13, 14, 16, 21, 26, 26, 28, 29, 35, 38, 42, 47, 47, 62, 67, 77, 81, 81, 83, 84, 88, 90, 96, 97, 98), 17, true)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-48, -8, 20, 32, -90, -42, -6, -88, -72, 42, 66, -62, 82, -4, 8, 12, -22, 82, 56, 96, -54, 92, -42, 30, -18, 14, -6, -66, 34, 16, -84, -94, 48, -48, 52, -60, -92, -16), 35, true)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), 14, true)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(45, 86, 53, 80, 27, 45, 1, 85, 91, 93, 92, 43, 75, 86, 81, 48, 21, 34, 5, 10, 88, 42, 7, 15, 96, 85, 62, 86, 52, 37), 29, true)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: checkIfAllTheElementsCanBeMadeOfSameParityByInvertingAdjacentElements
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