title: Find Maximum Product Of A Triplet In Array
signature: function find_maximum_product_of_a_triplet_in_array(arr, n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(arr, n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver([41, 66, 77], 2, -1);
      @printf("TEST-0...%s\n",result);
      
      result = driver([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);
      @printf("TEST-1...%s\n",result);
      
      result = driver([0, 0, 1], 1, -1);
      @printf("TEST-2...%s\n",result);
      
      result = driver([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);
      @printf("TEST-3...%s\n",result);
      
      result = driver([-62, -28, 40, 76], 3, 69440);
      @printf("TEST-4...%s\n",result);
      
      result = driver([0, 1, 1, 0, 1, 1, 1, 1, 1], 5, 1);
      @printf("TEST-5...%s\n",result);
      
      result = driver([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);
      @printf("TEST-6...%s\n",result);
      
      result = driver([-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);
      @printf("TEST-7...%s\n",result);
      
      result = driver([0, 0, 0, 0, 0, 1, 1, 1], 7, 0);
      @printf("TEST-8...%s\n",result);
      
      result = driver([85, 36, 7, 69, 9, 45, 18, 47, 1, 78, 72, 53, 37, 20, 95, 71, 58, 41], 14, 477360);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
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;
  }