title: Find A Triplet That Sum To A Given Value 1
signature: findATripletThatSumToAGivenValue1(a, arr_size, sum) {
source_py: def find_a_triplet_that_sum_to_a_given_value_1(A, arr_size, sum):
      A.sort()
      for i in range(0, (arr_size - 2)):
          l = (i + 1)
          r = (arr_size - 1)
          while (l < r):
              if (((A[i] + A[l]) + A[r]) == sum):
                  print('Triplet is', A[i], ', ', A[l], ', ', A[r])
                  return True
              elif (((A[i] + A[l]) + A[r]) < sum):
                  l += 1
              else:
                  r -= 1
      return False
source_cpp: bool find_a_triplet_that_sum_to_a_given_value_1(vector<int> A, int arr_size, int sum) {
    int l, r;
    sort(A.begin(), A.end());
    for ( int i = 0;
    i < arr_size - 2;
    i ++ ) {
      l = i + 1;
      r = arr_size - 1;
      while ( l < r ) {
        if ( A [ i ] + A [ l ] + A [ r ] == sum ) {
          return true;
        }
        else if ( A [ i ] + A [ l ] + A [ r ] < sum ) l ++;
        else r --;
      }
    }
    return false;
  }