title: Find Sum Non Repeating Distinct Elements Array
signature: findSumNonRepeatingDistinctElementsArray(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(
          [5, 6, 8, 10, 21, 22, 27, 32, 35, 36, 43, 44, 46, 48, 49, 55, 60, 61, 69, 69, 71, 72, 73, 78, 88, 94], 24, 
          971)
      }");
  
      print("TEST-1...${driver(
          [80, 94, 16, -74, 32, -64, -84, -66, -10], 6, 
          84)
      }");
  
      print("TEST-2...${driver(
          [0, 0, 0, 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], 27, 
          1)
      }");
  
      print("TEST-3...${driver(
          [99, 4, 96, 39, 39, 24, 15, 47, 25, 74, 7, 98, 88, 91, 62, 12, 31, 14, 48, 26, 37, 25, 11, 32, 34, 64, 72, 5, 80, 86, 6], 15, 
          769)
      }");
  
      print("TEST-4...${driver(
          [-86, -84, -84, -78, -78, -76, -74, -68, -66, -64, -60, -60, -56, -50, -42, -42, -38, -34, -32, -22, -16, -14, -10, -6, -6, 4, 4, 26, 36, 36, 54, 62, 64, 68, 70, 76, 76, 76, 84, 92, 92, 94, 96], 27, 
          -972)
      }");
  
      print("TEST-5...${driver(
          [1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1], 25, 
          1)
      }");
  
      print("TEST-6...${driver(
          [3, 3, 5, 8, 32, 33, 35, 35, 42, 48, 67, 71, 71, 74, 77, 80, 94, 96, 96, 97], 19, 
          765)
      }");
  
      print("TEST-7...${driver(
          [-50, -18, -66, 76, -54, 96, 98, 26, 42, 64, -60], 9, 
          150)
      }");
  
      print("TEST-8...${driver(
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 15, 
          1)
      }");
  
      print("TEST-9...${driver(
          [70, 21, 44, 82, 62, 41, 86], 3, 
          135)
      }");
  
      return 0;
  }
source_py: def find_sum_non_repeating_distinct_elements_array(arr, n):
      s = set()
      sum = 0
      for i in range(n):
          if (arr[i] not in s):
              s.add(arr[i])
      for i in s:
          sum = (sum + i)
      return sum
source_cpp: int find_sum_non_repeating_distinct_elements_array(vector<int> arr, int n) {
    int sum = 0;
    unordered_set < int > s;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( s . find ( arr [ i ] ) == s . end ( ) ) {
        sum += arr [ i ];
        s . insert ( arr [ i ] );
      }
    }
    return sum;
  }