title: Find Repetitive Element 1 N 1
signature: class Solution {
  
      public Integer findRepetitiveElement1N1(ArrayList<Integer> arr, Integer n) {
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 );
  }
question_info.extension: java
question_info.entry_fn_name: findRepetitiveElement1N1
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 313, "inputs": {"arr": [4, 8, 27, 34, 39, 42, 43, 54, 72], "n": 5}}, {"idx": 1, "outputs": -520, "inputs": {"arr": [-38, -66, -38, -48, -96, 74, -32, -62, -34, -32, -88, -12, -8, -4], "n": 9}}, {"idx": 2, "outputs": -23, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], "n": 8}}, {"idx": 3, "outputs": 2101, "inputs": {"arr": [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], "n": 31}}, {"idx": 4, "outputs": 76, "inputs": {"arr": [-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], "n": 28}}, {"idx": 5, "outputs": -288, "inputs": {"arr": [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], "n": 25}}, {"idx": 6, "outputs": 1159, "inputs": {"arr": [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], "n": 27}}, {"idx": 7, "outputs": -45, "inputs": {"arr": [52, -56, -12, 78, 6, 32, 0, 36, 34, -54, -74, -32], "n": 11}}, {"idx": 8, "outputs": -86, "inputs": {"arr": [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], "n": 15}}, {"idx": 9, "outputs": 951, "inputs": {"arr": [10, 42, 50, 5, 74, 81, 30, 76, 6, 34, 86, 4, 77, 71, 96, 22, 34, 50, 35, 16, 60, 11, 21, 38], "n": 13}}]
question_info.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(4, 8, 27, 34, 39, 42, 43, 54, 72)), 5, 313);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-38, -66, -38, -48, -96, 74, -32, -62, -34, -32, -88, -12, -8, -4)), 9, -520);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)), 8, -23);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-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);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(52, -56, -12, 78, 6, 32, 0, 36, 34, -54, -74, -32)), 11, -45);
          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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 15, -86);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          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
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__