title: Find Maximum Product Of A Triplet In Array
signature: class Solution {
  
      public Integer findMaximumProductOfATripletInArray(ArrayList<Integer> arr, Integer n) {
source_py: def find_maximum_product_of_a_triplet_in_array(arr, n):
      if (n < 3):
          return (- 1)
      max_product = (- (sys.maxsize - 1))
      for i in range(0, (n - 2)):
          for j in range((i + 1), (n - 1)):
              for k in range((j + 1), n):
                  max_product = max(max_product, ((arr[i] * arr[j]) * arr[k]))
      return max_product
source_cpp: int find_maximum_product_of_a_triplet_in_array(vector<int> arr, int n) {
    if ( n < 3 ) return - 1;
    int max_product = INT_MIN;
    for ( int i = 0;
    i < n - 2;
    i ++ ) for ( int j = i + 1;
    j < n - 1;
    j ++ ) for ( int k = j + 1;
    k < n;
    k ++ ) max_product = max ( max_product, arr [ i ] * arr [ j ] * arr [ k ] );
    return max_product;
  }
question_info.extension: java
question_info.entry_fn_name: findMaximumProductOfATripletInArray
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": -1, "inputs": {"arr": [41, 66, 77], "n": 2}}, {"idx": 1, "outputs": 921984, "inputs": {"arr": [92, -34, -36, -50, 20, -94, 2, -86, 22, -50, 74, 84, 52, -84, 98, -50, 88, 26, -36, -36, 6, -50, -48, -84, 38, -96, -62, 34, 52, 92, 40, -84, 18, -90, 54, -38, -74, -98, -8, -92, -60, 86, -36, 94, 56], "n": 40}}, {"idx": 2, "outputs": -1, "inputs": {"arr": [0, 0, 1], "n": 1}}, {"idx": 3, "outputs": 931491, "inputs": {"arr": [2, 77, 99, 95, 78, 15, 69, 39, 34, 43, 66, 45, 97, 27, 67, 62, 64, 2, 28, 94, 41, 87, 97, 52, 14, 61, 78, 50], "n": 26}}, {"idx": 4, "outputs": 69440, "inputs": {"arr": [-62, -28, 40, 76], "n": 3}}, {"idx": 5, "outputs": 1, "inputs": {"arr": [0, 1, 1, 0, 1, 1, 1, 1, 1], "n": 5}}, {"idx": 6, "outputs": 230400, "inputs": {"arr": [2, 6, 10, 11, 12, 12, 17, 18, 18, 19, 20, 22, 24, 25, 30, 35, 36, 37, 40, 41, 42, 47, 60, 60, 64, 69, 69, 70, 73, 79, 80, 83, 97, 97, 97], "n": 25}}, {"idx": 7, "outputs": 740880, "inputs": {"arr": [-72, 98, 68, 18, 92, -84, 50, 32, -90, -40, 50, 60, -50, -50, 50, 24, 30, 94, -98, -6, 46, -46, -24, -62, -20, 62, -76], "n": 14}}, {"idx": 8, "outputs": 0, "inputs": {"arr": [0, 0, 0, 0, 0, 1, 1, 1], "n": 7}}, {"idx": 9, "outputs": 477360, "inputs": {"arr": [85, 36, 7, 69, 9, 45, 18, 47, 1, 78, 72, 53, 37, 20, 95, 71, 58, 41], "n": 14}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(ArrayList<Integer> arr, Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(arr, n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(new ArrayList<>(Arrays.asList(41, 66, 77)), 2, -1);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(92, -34, -36, -50, 20, -94, 2, -86, 22, -50, 74, 84, 52, -84, 98, -50, 88, 26, -36, -36, 6, -50, -48, -84, 38, -96, -62, 34, 52, 92, 40, -84, 18, -90, 54, -38, -74, -98, -8, -92, -60, 86, -36, 94, 56)), 40, 921984);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 1)), 1, -1);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(2, 77, 99, 95, 78, 15, 69, 39, 34, 43, 66, 45, 97, 27, 67, 62, 64, 2, 28, 94, 41, 87, 97, 52, 14, 61, 78, 50)), 26, 931491);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-62, -28, 40, 76)), 3, 69440);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 1, 1, 0, 1, 1, 1, 1, 1)), 5, 1);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(2, 6, 10, 11, 12, 12, 17, 18, 18, 19, 20, 22, 24, 25, 30, 35, 36, 37, 40, 41, 42, 47, 60, 60, 64, 69, 69, 70, 73, 79, 80, 83, 97, 97, 97)), 25, 230400);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-72, 98, 68, 18, 92, -84, 50, 32, -90, -40, 50, 60, -50, -50, 50, 24, 30, 94, -98, -6, 46, -46, -24, -62, -20, 62, -76)), 14, 740880);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 1, 1, 1)), 7, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(85, 36, 7, 69, 9, 45, 18, 47, 1, 78, 72, 53, 37, 20, 95, 71, 58, 41)), 14, 477360);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> arr, Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(arr, n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__