title: Maximum Triplet Sum Array 1
signature: maximum_triplet_sum_array_1 <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(6L, 8L, 18L, 18L, 27L, 33L, 33L, 38L, 42L, 43L, 44L, 47L, 52L, 58L, 64L, 65L, 67L, 68L, 71L, 75L, 85L, 89L, 91L, 94L, 94L, 95L, 95L), 26L, 
          283L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-88L, -84L, -82L, -58L, -12L, 18L, 24L, 24L, 28L, 30L, 34L, 44L, 92L, 94L), 8L, 
          66L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 15L, 
          2L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(1L, 2L, 4L, 5L, 9L, 11L, 12L, 15L, 16L, 18L, 18L, 21L, 23L, 25L, 25L, 26L, 27L, 28L, 31L, 34L, 35L, 47L, 51L, 55L, 63L, 63L, 66L, 67L, 70L, 70L, 72L, 73L, 73L, 75L, 76L, 79L, 81L, 84L, 87L, 87L, 92L, 94L, 95L), 37L, 
          236L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-86L, -86L, -78L, -56L, -24L, -14L, -10L, -6L, 12L, 12L, 18L, 22L, 22L, 26L, 50L, 50L, 72L, 78L, 94L), 9L, 
          -4L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 9L, 
          2L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(2L, 13L, 17L, 19L, 20L, 23L, 28L, 28L, 29L, 40L, 45L, 51L, 52L, 58L, 58L, 68L, 70L, 75L, 79L, 81L, 92L, 96L, 97L), 15L, 
          168L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-78L, -62L, -46L, -36L, -20L, -4L, 4L, 6L, 6L, 40L, 50L, 52L, 64L, 76L, 94L), 13L, 
          166L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(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, 1L, 1L, 1L), 27L, 
          3L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(3L, 3L, 4L, 5L, 6L, 7L, 11L, 11L, 14L, 15L, 17L, 22L, 25L, 32L, 33L, 34L, 35L, 42L, 44L, 44L, 52L, 57L, 58L, 66L, 70L, 89L), 13L, 
          64L
      )))
  
  }
  
  main()
source_py: def maximum_triplet_sum_array_1(arr, n):
      arr.sort()
      return ((arr[(n - 1)] + arr[(n - 2)]) + arr[(n - 3)])
source_cpp: int maximum_triplet_sum_array_1(vector<int> arr, int n) {
    sort(arr.begin(), arr.end());
    return arr [ n - 1 ] + arr [ n - 2 ] + arr [ n - 3 ];
  }