title: Find Maximum Product Of A Triplet In Array 1
signature: function findMaximumProductOfATripletInArray1(arr: Array<number>, n: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(arr: Array<number>, n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver([5, 8, 14, 15, 18, 21, 21, 21, 27, 29, 30, 33, 34, 34, 35, 37, 40, 41, 44, 44, 46, 49, 54, 58, 60, 61, 61, 63, 66, 69, 69, 70, 81, 82, 82, 90, 90, 90, 91, 92, 92, 96, 97, 99], 39, 737100);
    console.log(`TEST-0...${result}`);
  
    result = driver([-98, -98, -90, -88, -76, -66, -60, -58, -56, -52, -50, -32, -32, -22, -2, 12, 18, 28, 32, 48, 50, 56, 68, 70, 70, 72], 18, 268912);
    console.log(`TEST-1...${result}`);
  
    result = driver([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 17, 1);
    console.log(`TEST-2...${result}`);
  
    result = driver([2, 5, 5, 6, 17, 18, 18, 31, 38, 49, 53, 62, 63, 66, 69, 72, 74, 76, 76, 77, 81, 86, 91, 94, 95, 99, 99], 21, 474012);
    console.log(`TEST-3...${result}`);
  
    result = driver([-92, -58, -8, 20, 24, 24, 42, 98], 4, 106720);
    console.log(`TEST-4...${result}`);
  
    result = driver([0, 0, 0, 0, 0, 0, 0, 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, 1], 38, 1);
    console.log(`TEST-5...${result}`);
  
    result = driver([46, 64, 81], 1, -1);
    console.log(`TEST-6...${result}`);
  
    result = driver([-96, -92, -80, -40, -26, -18, -14, -8, -4, 4, 20, 34, 34, 42, 44, 58, 60, 68, 76, 92, 94, 96], 17, 529920);
    console.log(`TEST-7...${result}`);
  
    result = driver([0, 0, 0, 1, 1, 1, 1, 1], 7, 1);
    console.log(`TEST-8...${result}`);
  
    result = driver([1, 1, 4, 6, 17, 17, 18, 23, 28, 41, 46, 52, 58, 61, 70, 73, 75, 79, 79, 83, 94, 97, 98], 19, 468075);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
source_py: def find_maximum_product_of_a_triplet_in_array_1(arr, n):
      if (n < 3):
          return (- 1)
      arr.sort()
      return max(((arr[0] * arr[1]) * arr[(n - 1)]), ((arr[(n - 1)] * arr[(n - 2)]) * arr[(n - 3)]))
source_cpp: int find_maximum_product_of_a_triplet_in_array_1(vector<int> arr, int n) {
    if ( n < 3 ) return - 1;
    sort(arr.begin(), arr.end());
    return max ( arr [ 0 ] * arr [ 1 ] * arr [ n - 1 ], arr [ n - 1 ] * arr [ n - 2 ] * arr [ n - 3 ] );
  }