title: Find The Number Occurring Odd Number Of Times 1
signature: class Solution {
  
      public Integer findTheNumberOccurringOddNumberOfTimes1(ArrayList<Integer> arr, Integer size) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(ArrayList<Integer> arr, Integer size, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(arr, size,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(new ArrayList<>(Arrays.asList(49, 90)), 1, 49);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-96, 94, 92, -24, 48, 54, -30, -86, 28, -18, 12, -64, -36, 68, 68, -78, -6, 30, -84, 20, 52, -36, 40, -62, 90, -48, 86, 98, 12, 44, 98, -66, 52, 34, 36, 76, -50, -20, -20, -20)), 39, -96);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 1)), 1, 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(79, 55, 18, 99, 38, 93, 19, 49, 21, 74, 16, 76, 82, 52, 86, 17, 42, 9, 6, 63, 1, 40, 75, 59, 41, 81)), 23, 79);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-90, -84, -82, -68, -66, -66, -60, -60, -48, -44, -36, -34, -30, -16, -14, -12, -10, -6, 2, 10, 10, 14, 22, 26, 30, 34, 46, 50, 52, 62, 64, 64, 66, 72, 74, 78, 78, 82, 84, 88, 92)), 23, -90);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1)), 18, 1);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(2, 4, 5, 7, 7, 18, 18, 23, 23, 25, 25, 31, 41, 43, 45, 46, 52, 52, 55, 64, 69, 69, 80, 81, 84, 90, 91, 93, 94, 94, 94, 94, 96, 98, 99)), 20, 2);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(86, 66, -8, 2, -18, -22, 38, 4, -38, -54, 78, 64, 78, 20, -32, 84, -70, 66, -46, 12, -12, 8, 44, 14, 20)), 20, 86);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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)), 21, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(11, 4, 98, 38, 20, 41, 1, 8)), 7, 11);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> arr, Integer size, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(arr, size),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def find_the_number_occurring_odd_number_of_times_1(arr, size):
      Hash = dict()
      for i in range(size):
          Hash[arr[i]] = (Hash.get(arr[i], 0) + 1)
      for i in Hash:
          if ((Hash[i] % 2) != 0):
              return i
      return (- 1)
source_cpp: int find_the_number_occurring_odd_number_of_times_1(vector<int> arr, int size) {
    unordered_map < int, int > hash;
    for ( int i = 0;
    i < size;
    i ++ ) {
      hash [ arr [ i ] ] ++;
    }
    for ( auto i : hash ) {
      if ( i . second % 2 != 0 ) {
        return i . first;
      }
    }
    return - 1;
  }