title: Find Maximum Product Of A Triplet In Array 1
signature: find_maximum_product_of_a_triplet_in_array_1 <- 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(5L, 8L, 14L, 15L, 18L, 21L, 21L, 21L, 27L, 29L, 30L, 33L, 34L, 34L, 35L, 37L, 40L, 41L, 44L, 44L, 46L, 49L, 54L, 58L, 60L, 61L, 61L, 63L, 66L, 69L, 69L, 70L, 81L, 82L, 82L, 90L, 90L, 90L, 91L, 92L, 92L, 96L, 97L, 99L), 39L, 
          737100L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-98L, -98L, -90L, -88L, -76L, -66L, -60L, -58L, -56L, -52L, -50L, -32L, -32L, -22L, -2L, 12L, 18L, 28L, 32L, 48L, 50L, 56L, 68L, 70L, 70L, 72L), 18L, 
          268912L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 17L, 
          1L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(2L, 5L, 5L, 6L, 17L, 18L, 18L, 31L, 38L, 49L, 53L, 62L, 63L, 66L, 69L, 72L, 74L, 76L, 76L, 77L, 81L, 86L, 91L, 94L, 95L, 99L, 99L), 21L, 
          474012L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-92L, -58L, -8L, 20L, 24L, 24L, 42L, 98L), 4L, 
          106720L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 38L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(46L, 64L, 81L), 1L, 
          -1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-96L, -92L, -80L, -40L, -26L, -18L, -14L, -8L, -4L, 4L, 20L, 34L, 34L, 42L, 44L, 58L, 60L, 68L, 76L, 92L, 94L, 96L), 17L, 
          529920L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L), 7L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(1L, 1L, 4L, 6L, 17L, 17L, 18L, 23L, 28L, 41L, 46L, 52L, 58L, 61L, 70L, 73L, 75L, 79L, 79L, 83L, 94L, 97L, 98L), 19L, 
          468075L
      )))
  
  }
  
  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 ] );
  }