title: Find Maximum Product Of A Triplet In Array
signature: find_maximum_product_of_a_triplet_in_array <- 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(41L, 66L, 77L), 2L, 
          -1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(92L, -34L, -36L, -50L, 20L, -94L, 2L, -86L, 22L, -50L, 74L, 84L, 52L, -84L, 98L, -50L, 88L, 26L, -36L, -36L, 6L, -50L, -48L, -84L, 38L, -96L, -62L, 34L, 52L, 92L, 40L, -84L, 18L, -90L, 54L, -38L, -74L, -98L, -8L, -92L, -60L, 86L, -36L, 94L, 56L), 40L, 
          921984L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 1L), 1L, 
          -1L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(2L, 77L, 99L, 95L, 78L, 15L, 69L, 39L, 34L, 43L, 66L, 45L, 97L, 27L, 67L, 62L, 64L, 2L, 28L, 94L, 41L, 87L, 97L, 52L, 14L, 61L, 78L, 50L), 26L, 
          931491L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-62L, -28L, 40L, 76L), 3L, 
          69440L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L), 5L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(2L, 6L, 10L, 11L, 12L, 12L, 17L, 18L, 18L, 19L, 20L, 22L, 24L, 25L, 30L, 35L, 36L, 37L, 40L, 41L, 42L, 47L, 60L, 60L, 64L, 69L, 69L, 70L, 73L, 79L, 80L, 83L, 97L, 97L, 97L), 25L, 
          230400L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-72L, 98L, 68L, 18L, 92L, -84L, 50L, 32L, -90L, -40L, 50L, 60L, -50L, -50L, 50L, 24L, 30L, 94L, -98L, -6L, 46L, -46L, -24L, -62L, -20L, 62L, -76L), 14L, 
          740880L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L), 7L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(85L, 36L, 7L, 69L, 9L, 45L, 18L, 47L, 1L, 78L, 72L, 53L, 37L, 20L, 95L, 71L, 58L, 41L), 14L, 
          477360L
      )))
  
  }
  
  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;
  }