title: Find Sum Non Repeating Distinct Elements Array
signature: fun findSumNonRepeatingDistinctElementsArray(arr: ArrayList<Int>, n: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(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)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(80, 94, 16, -74, 32, -64, -84, -66, -10), 6, 84)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(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)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(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)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-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)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(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)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(3, 3, 5, 8, 32, 33, 35, 35, 42, 48, 67, 71, 71, 74, 77, 80, 94, 96, 96, 97), 19, 765)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-50, -18, -66, 76, -54, 96, 98, 26, 42, 64, -60), 9, 150)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(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)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(70, 21, 44, 82, 62, 41, 86), 3, 135)
      println("TEST-9...${result}")
      
          
  }
  
  main()
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;
  }