title: Maximum Triplet Sum Array 1
signature: def maximumTripletSumArray1(arr: List[Int], n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(arr: List[Int], n: Int, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        List(6, 8, 18, 18, 27, 33, 33, 38, 42, 43, 44, 47, 52, 58, 64, 65, 67, 68, 71, 75, 85, 89, 91, 94, 94, 95, 95), 26, 
        283    
      )}")   
  
  
      println(s"TEST-1...${driver(
        List(-88, -84, -82, -58, -12, 18, 24, 24, 28, 30, 34, 44, 92, 94), 8, 
        66    
      )}")   
  
  
      println(s"TEST-2...${driver(
        List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), 15, 
        2    
      )}")   
  
  
      println(s"TEST-3...${driver(
        List(1, 2, 4, 5, 9, 11, 12, 15, 16, 18, 18, 21, 23, 25, 25, 26, 27, 28, 31, 34, 35, 47, 51, 55, 63, 63, 66, 67, 70, 70, 72, 73, 73, 75, 76, 79, 81, 84, 87, 87, 92, 94, 95), 37, 
        236    
      )}")   
  
  
      println(s"TEST-4...${driver(
        List(-86, -86, -78, -56, -24, -14, -10, -6, 12, 12, 18, 22, 22, 26, 50, 50, 72, 78, 94), 9, 
        -4    
      )}")   
  
  
      println(s"TEST-5...${driver(
        List(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1), 9, 
        2    
      )}")   
  
  
      println(s"TEST-6...${driver(
        List(2, 13, 17, 19, 20, 23, 28, 28, 29, 40, 45, 51, 52, 58, 58, 68, 70, 75, 79, 81, 92, 96, 97), 15, 
        168    
      )}")   
  
  
      println(s"TEST-7...${driver(
        List(-78, -62, -46, -36, -20, -4, 4, 6, 6, 40, 50, 52, 64, 76, 94), 13, 
        166    
      )}")   
  
  
      println(s"TEST-8...${driver(
        List(0, 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, 1, 1, 1, 1), 27, 
        3    
      )}")   
  
  
      println(s"TEST-9...${driver(
        List(3, 3, 4, 5, 6, 7, 11, 11, 14, 15, 17, 22, 25, 32, 33, 34, 35, 42, 44, 44, 52, 57, 58, 66, 70, 89), 13, 
        64    
      )}")   
  
  }
  
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 ];
  }