title: Find Repetitive Element 1 N 1
signature: findRepetitiveElement1N1(arr, n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(arr, n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          [4, 8, 27, 34, 39, 42, 43, 54, 72], 5, 
          313)
      }");
  
      print("TEST-1...${driver(
          [-38, -66, -38, -48, -96, 74, -32, -62, -34, -32, -88, -12, -8, -4], 9, 
          -520)
      }");
  
      print("TEST-2...${driver(
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], 8, 
          -23)
      }");
  
      print("TEST-3...${driver(
          [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)
      }");
  
      print("TEST-4...${driver(
          [-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)
      }");
  
      print("TEST-5...${driver(
          [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)
      }");
  
      print("TEST-6...${driver(
          [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)
      }");
  
      print("TEST-7...${driver(
          [52, -56, -12, 78, 6, 32, 0, 36, 34, -54, -74, -32], 11, 
          -45)
      }");
  
      print("TEST-8...${driver(
          [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)
      }");
  
      print("TEST-9...${driver(
          [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)
      }");
  
      return 0;
  }
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 );
  }