title: Find Maximum Product Of A Triplet In Array 1
signature: pub fn find_maximum_product_of_a_triplet_in_array_1(arr: Vec<i32>, n: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(arr: Vec<i32>, n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        Vec::from([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
      ));
      
      println!("TEST-1...{}", driver(
        Vec::from([-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
      ));
      
      println!("TEST-2...{}", driver(
        Vec::from([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
      ));
      
      println!("TEST-3...{}", driver(
        Vec::from([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
      ));
      
      println!("TEST-4...{}", driver(
        Vec::from([-92, -58, -8, 20, 24, 24, 42, 98]), 4, 
        106720
      ));
      
      println!("TEST-5...{}", driver(
        Vec::from([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
      ));
      
      println!("TEST-6...{}", driver(
        Vec::from([46, 64, 81]), 1, 
        -1
      ));
      
      println!("TEST-7...{}", driver(
        Vec::from([-96, -92, -80, -40, -26, -18, -14, -8, -4, 4, 20, 34, 34, 42, 44, 58, 60, 68, 76, 92, 94, 96]), 17, 
        529920
      ));
      
      println!("TEST-8...{}", driver(
        Vec::from([0, 0, 0, 1, 1, 1, 1, 1]), 7, 
        1
      ));
      
      println!("TEST-9...{}", driver(
        Vec::from([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
      ));
      
  }
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 ] );
  }