title: Non Repeating Element
signature: class Solution {
  
      public Integer nonRepeatingElement(ArrayList<Integer> arr, Integer n) {
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 n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(arr, n,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(1, 2, 3, 4, 6, 6, 7, 9, 10, 13, 16, 23, 30, 32, 36, 42, 42, 43, 44, 47, 48, 48, 49, 52, 52, 53, 55, 56, 58, 59, 60, 60, 63, 67, 68, 68, 74, 75, 76, 80, 81, 81, 83, 83, 86, 87, 91, 92, 97)), 47, 1);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-96, -46, -86, 56, -72, 50, 18, 8, 50)), 8, -96);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 14, -1);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(19, 10, 49, 40, 34, 21, 63, 51)), 5, 19);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-96, -96, -90, -88, -88, -84, -80, -76, -68, -64, -64, -52, -52, -52, -52, -50, -50, -48, -48, -40, -32, -26, -24, -22, -20, -14, -12, 0, 6, 8, 10, 20, 24, 28, 34, 36, 54, 60, 60, 60, 68, 74, 74, 74, 84, 88, 94)), 27, -90);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0)), 19, -1);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 2, 3, 10, 15, 21, 28, 36, 41, 44, 45, 47, 72, 77, 77, 79, 85)), 15, 1);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(42, -84, 42, 36, -10, 24, -62, 60)), 7, -84);
          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, 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)), 35, -1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(2, 21, 42, 92, 65, 62, 75, 43, 81, 17, 92, 86, 37, 63, 27, 97, 24, 61, 85, 49, 84, 7, 14, 19, 60, 55, 68, 79, 8, 12, 75, 12, 92, 79, 42)), 27, 2);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> arr, Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(arr, n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def non_repeating_element(arr, n):
      for i in range(n):
          j = 0
          while (j < n):
              if ((i != j) and (arr[i] == arr[j])):
                  break
              j += 1
          if (j == n):
              return arr[i]
      return (- 1)
source_cpp: int non_repeating_element(vector<int> arr, int n) {
    for ( int i = 0;
    i < n;
    i ++ ) {
      int j;
      for ( j = 0;
      j < n;
      j ++ ) if ( i != j && arr [ i ] == arr [ j ] ) break;
      if ( j == n ) return arr [ i ];
    }
    return - 1;
  }