title: Find A Triplet That Sum To A Given Value 2
signature: function findATripletThatSumToAGivenValue2($a, $arr_size, $sum) {
source_py: def find_a_triplet_that_sum_to_a_given_value_2(A, arr_size, sum):
      for i in range(0, (arr_size - 1)):
          s = set()
          curr_sum = (sum - A[i])
          for j in range((i + 1), arr_size):
              if ((curr_sum - A[j]) in s):
                  print('Triplet is', A[i], ', ', A[j], ', ', (curr_sum - A[j]))
                  return True
              s.add(A[j])
      return False
source_cpp: bool find_a_triplet_that_sum_to_a_given_value_2(vector<int> A, int arr_size, int sum) {
    for ( int i = 0;
    i < arr_size - 2;
    i ++ ) {
      unordered_set < int > s;
      int curr_sum = sum - A [ i ];
      for ( int j = i + 1;
      j < arr_size;
      j ++ ) {
        if ( s . find ( curr_sum - A [ j ] ) != s . end ( ) ) {
          return true;
        }
        s . insert ( A [ j ] );
      }
    }
    return false;
  }