title: Find Repetitive Element 1 N 1
signature: function findRepetitiveElement1N1($arr, $n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($arr, $n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($arr, $n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        array(4, 8, 27, 34, 39, 42, 43, 54, 72), 5, 
        313));
      
      printf("TEST-1...%s\n",driver(
        array(-38, -66, -38, -48, -96, 74, -32, -62, -34, -32, -88, -12, -8, -4), 9, 
        -520));
      
      printf("TEST-2...%s\n",driver(
        array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1), 8, 
        -23));
      
      printf("TEST-3...%s\n",driver(
        array(88, 86, 23, 81, 76, 16, 94, 64, 59, 50, 71, 62, 10, 89, 73, 64, 65, 96, 83, 40, 99, 40, 77, 33, 14, 62, 6, 89, 74, 96, 93, 29, 15, 93, 9, 58, 98, 76, 23, 23, 70, 99), 31, 
        2101));
      
      printf("TEST-4...%s\n",driver(
        array(-96, -94, -82, -64, -56, -40, -36, -34, -32, -24, -24, -22, -20, -20, -20, -18, -18, -12, -10, -6, 16, 20, 20, 22, 26, 30, 36, 46, 46, 50, 50, 52, 64, 64, 64, 68, 72, 74, 76, 92, 96, 98), 28, 
        76));
      
      printf("TEST-5...%s\n",driver(
        array(0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1), 25, 
        -288));
      
      printf("TEST-6...%s\n",driver(
        array(2, 6, 7, 13, 19, 23, 37, 39, 42, 42, 43, 45, 52, 53, 55, 56, 59, 63, 66, 71, 76, 85, 86, 89, 92, 94, 96, 99), 27, 
        1159));
      
      printf("TEST-7...%s\n",driver(
        array(52, -56, -12, 78, 6, 32, 0, 36, 34, -54, -74, -32), 11, 
        -45));
      
      printf("TEST-8...%s\n",driver(
        array(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), 15, 
        -86));
      
      printf("TEST-9...%s\n",driver(
        array(10, 42, 50, 5, 74, 81, 30, 76, 6, 34, 86, 4, 77, 71, 96, 22, 34, 50, 35, 16, 60, 11, 21, 38), 13, 
        951));
      
  }
  
  main();
  ?>
source_py: def find_repetitive_element_1_n_1(arr, n):
      return (sum(arr) - (((n - 1) * n) // 2))
source_cpp: int find_repetitive_element_1_n_1(vector<int> arr, int n) {
    return accumulate(arr.begin(), arr.end(), 0 ) - ( ( n - 1 ) * n / 2 );
  }