title: Find A Triplet That Sum To A Given Value
signature: find_a_triplet_that_sum_to_a_given_value <- function(a, arr_size, sum) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, arr_size, sum, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, arr_size, sum), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(15L, 18L, 38L, 47L, 75L, 88L), 5L, 4L, 
          FALSE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(28L, -2L, 62L, 38L, 86L, -86L, 56L, 58L, 96L, 6L, -28L, 8L, 68L, -16L, -80L, -4L, 98L, -92L, 4L, -4L, 58L, -62L, 46L, 64L), 22L, 18L, 
          TRUE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 27L, 23L, 
          FALSE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(19L, 77L, 17L, 91L, 6L, 35L, 22L, 4L, 30L, 23L, 97L, 56L, 78L, 16L, 22L, 23L, 95L, 57L, 43L, 27L, 47L, 44L, 23L, 10L, 3L, 94L, 55L, 22L, 93L, 32L, 89L, 28L, 64L, 22L, 13L, 24L, 38L, 44L, 6L, 1L, 80L), 22L, 29L, 
          TRUE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-98L, -98L, -94L, -88L, -80L, -74L, -68L, -68L, -64L, -44L, -36L, -24L, -10L, -8L, -8L, 0L, 4L, 6L, 8L, 8L, 12L, 14L, 16L, 38L, 50L, 52L, 54L, 56L, 66L, 68L, 76L, 88L), 18L, 19L, 
          FALSE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L), 4L, 5L, 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(7L, 22L, 24L, 30L, 42L, 44L, 49L, 49L, 65L, 70L, 70L, 74L, 74L, 75L, 90L, 95L, 96L), 8L, 13L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(40L, -76L, -68L, -86L, -14L, 82L, -20L, 54L, -26L, 56L, -24L, -44L, 44L, 60L, 52L, -20L, 80L, -24L, -90L, -30L, -2L), 11L, 18L, 
          TRUE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 15L, 17L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(33L, 92L, 6L, 99L, 83L, 97L, 49L, 97L, 85L, 52L), 6L, 7L, 
          FALSE
      )))
  
  }
  
  main()
source_py: def find_a_triplet_that_sum_to_a_given_value(A, arr_size, sum):
      for i in range(0, (arr_size - 2)):
          for j in range((i + 1), (arr_size - 1)):
              for k in range((j + 1), arr_size):
                  if (((A[i] + A[j]) + A[k]) == sum):
                      print('Triplet is', A[i], ', ', A[j], ', ', A[k])
                      return True
      return False
source_cpp: bool find_a_triplet_that_sum_to_a_given_value(vector<int> A, int arr_size, int sum) {
    int l, r;
    for ( int i = 0;
    i < arr_size - 2;
    i ++ ) {
      for ( int j = i + 1;
      j < arr_size - 1;
      j ++ ) {
        for ( int k = j + 1;
        k < arr_size;
        k ++ ) {
          if ( A [ i ] + A [ j ] + A [ k ] == sum ) {
            return true;
          }
        }
      }
    }
    return false;
  }