title: Check Exist Two Elements Array Whose Sum Equal Sum Rest Array
signature: check_exist_two_elements_array_whose_sum_equal_sum_rest_array <- 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, 11L, 5L, 1L, 4L, 7L), 6L, 
          FALSE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(2L, 4L, 2L, 1L, 11L, 15L), 6L, 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 13L, 
          FALSE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(69L, 6L, 24L, 30L, 75L, 37L, 61L, 76L, 19L, 18L, 90L, 9L, 49L, 24L, 58L, 97L, 18L, 85L, 24L, 93L, 71L, 98L, 92L, 59L, 75L, 75L, 75L, 70L, 35L, 58L, 50L, 1L, 64L, 66L, 33L), 18L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-94L, -94L, -92L, -74L, -60L, -58L, -56L, -44L, -42L, -40L, -28L, -14L, 2L, 4L, 14L, 20L, 24L, 28L, 40L, 42L, 42L, 66L, 78L, 78L, 80L, 82L, 96L), 26L, 
          FALSE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L), 10L, 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(21L, 26L, 26L, 27L, 61L, 62L, 96L), 6L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-54L, 86L, 20L, 26L), 3L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 4L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(44L, 35L, 26L, 15L, 56L, 6L, 36L, 53L, 15L, 66L, 20L, 53L, 99L, 96L, 51L, 12L, 61L, 19L, 79L, 40L, 99L, 42L, 86L, 8L, 11L, 54L, 93L, 46L, 23L, 47L, 41L, 26L, 66L, 5L, 86L, 52L, 64L, 51L, 4L, 21L, 63L, 14L, 7L, 53L, 31L, 8L, 9L, 63L), 31L, 
          FALSE
      )))
  
  }
  
  main()
source_py: def check_exist_two_elements_array_whose_sum_equal_sum_rest_array(arr, n):
      s = set()
      sum = 0
      for i in range(n):
          sum += arr[i]
      if ((sum % 2) != 0):
          return False
      sum = (sum / 2)
      for i in range(n):
          val = (sum - arr[i])
          if (arr[i] not in s):
              s.add(arr[i])
          if (val in s):
              print('Pair elements are', arr[i], 'and', int(val))
source_cpp: bool check_exist_two_elements_array_whose_sum_equal_sum_rest_array(vector<int> arr, int n) {
    int sum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) sum += arr [ i ];
    if ( sum % 2 != 0 ) return false;
    sum = sum / 2;
    unordered_set < int > s;
    for ( int i = 0;
    i < n;
    i ++ ) {
      int val = sum - arr [ i ];
      if ( s . find ( val ) != s . end ( ) ) {
        return true;
      }
      s . insert ( arr [ i ] );
    }
    return false;
  }