title: Find Repetitive Element 1 N 1 2
signature: find_repetitive_element_1_n_1_2 <- 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(2L, 2L, 4L, 5L, 5L, 7L, 7L, 7L, 8L, 11L, 14L, 15L, 18L, 19L, 20L, 25L, 25L, 29L, 29L, 31L, 32L, 32L, 33L, 38L, 42L, 48L, 52L, 55L, 60L, 61L, 63L, 71L, 74L, 78L, 82L, 82L, 84L, 84L, 87L, 87L, 88L, 90L, 93L, 94L, 94L), 31L, 
          52L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(46L, 2L, 62L, 60L, 92L, 4L, 26L, 66L, 66L, 90L, 26L, -14L, 76L, -20L, -68L), 8L, 
          46L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L), 4L, 
          1L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(87L, 67L, 11L, 47L, 64L, 81L, 94L, 75L, 58L, 77L, 18L, 2L, 85L, 26L, 6L, 44L, 55L, 19L, 46L, 49L, 5L, 69L, 44L, 12L, 42L, 66L, 46L, 9L, 26L, 49L, 68L, 95L, 6L, 9L, 11L, 72L, 5L, 67L), 34L, 
          28L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-98L, -94L, -92L, -82L, -78L, -64L, -62L, -58L, -52L, -44L, -40L, -38L, -8L, 6L, 10L, 20L, 22L, 28L, 30L, 30L, 36L, 54L, 54L, 58L, 64L, 68L, 76L, 78L, 84L, 88L, 90L, 94L, 96L), 29L, 
          -32L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L), 17L, 
          16L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 14L, 15L, 15L, 21L, 34L, 38L, 39L, 41L, 50L, 60L, 74L, 96L, 97L), 7L, 
          25L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(96L, -12L, -16L, -52L), 3L, 
          103L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 21L, 
          21L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(66L, 21L, 21L, 59L, 78L, 8L, 46L, 41L, 16L, 32L, 97L, 93L, 32L, 86L, 91L, 61L, 67L, 61L, 97L, 49L, 66L, 35L, 24L, 35L, 65L, 45L, 83L), 25L, 
          9L
      )))
  
  }
  
  main()
source_py: def find_repetitive_element_1_n_1_2(arr, n):
      res = 0
      for i in range(0, (n - 1)):
          res = ((res ^ (i + 1)) ^ arr[i])
      res = (res ^ arr[(n - 1)])
      return res
source_cpp: int find_repetitive_element_1_n_1_2(vector<int> arr, int n) {
    int res = 0;
    for ( int i = 0;
    i < n - 1;
    i ++ ) res = res ^ ( i + 1 ) ^ arr [ i ];
    res = res ^ arr [ n - 1 ];
    return res;
  }