title: Minimum Cost Make Array Size 1 Removing Larger Pairs
signature: function minimumCostMakeArraySize1RemovingLargerPairs(a: Array<number>, n: number): number {
source_py: def minimum_cost_make_array_size_1_removing_larger_pairs(a, n):
      return ((n - 1) * min(a))
source_cpp: int minimum_cost_make_array_size_1_removing_larger_pairs(vector<int> a, int n) {
    return ( n - 1 ) * ( * min_element(a.begin(), a.end()) );
  }
question_info.test_list: [{"idx": 0, "outputs": 24, "inputs": {"a": [1, 2, 3, 4, 7, 8, 10, 10, 16, 20, 22, 22, 23, 23, 23, 27, 29, 32, 35, 39, 41, 46, 51, 53, 54, 59, 59, 60, 61, 69, 70, 70, 79, 79, 81, 84, 90, 91, 98], "n": 25}}, {"idx": 1, "outputs": 0, "inputs": {"a": [-6, 10], "n": 1}}, {"idx": 2, "outputs": 0, "inputs": {"a": [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 15}}, {"idx": 3, "outputs": 110, "inputs": {"a": [20, 61, 92, 45, 75, 26, 83, 5, 85, 27, 39, 88, 36, 39, 83, 41, 56, 77, 39, 69, 72, 98, 39, 15, 29, 69, 64, 92, 96, 49, 59, 62, 53, 82, 40, 37, 29, 41], "n": 23}}, {"idx": 4, "outputs": -2200, "inputs": {"a": [-88, -60, -60, -58, -56, -56, -46, -44, -40, -38, -32, -28, -22, -18, -12, -4, -2, 10, 24, 24, 28, 38, 42, 46, 54, 64, 72, 74, 78, 96, 96], "n": 26}}, {"idx": 5, "outputs": 0, "inputs": {"a": [0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1], "n": 39}}, {"idx": 6, "outputs": 27, "inputs": {"a": [1, 4, 6, 9, 10, 12, 17, 17, 18, 21, 22, 26, 26, 31, 32, 33, 34, 39, 42, 43, 45, 46, 48, 50, 53, 53, 54, 55, 60, 61, 62, 63, 63, 64, 70, 70, 70, 71, 71, 78, 86, 88, 91, 92, 95, 95, 96, 97, 99], "n": 28}}, {"idx": 7, "outputs": -1584, "inputs": {"a": [-42, 44, -80, -60, 48, 66, 54, -76, 26, -74, -10, 46, -50, 42, -26, -24, -14, 36, -2, -26, 16, -10, 20, -88, -78], "n": 19}}, {"idx": 8, "outputs": 0, "inputs": {"a": [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], "n": 5}}, {"idx": 9, "outputs": 63, "inputs": {"a": [65, 32, 66, 82, 86, 98, 15, 33, 57, 3, 73, 45, 90, 82, 33, 99, 44, 76, 50, 89, 5, 7, 64], "n": 22}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(a: Array<number>, n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(a, n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver([1, 2, 3, 4, 7, 8, 10, 10, 16, 20, 22, 22, 23, 23, 23, 27, 29, 32, 35, 39, 41, 46, 51, 53, 54, 59, 59, 60, 61, 69, 70, 70, 79, 79, 81, 84, 90, 91, 98], 25, 24);
    console.log(`TEST-0...${result}`);
  
    result = driver([-6, 10], 1, 0);
    console.log(`TEST-1...${result}`);
  
    result = driver([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 15, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver([20, 61, 92, 45, 75, 26, 83, 5, 85, 27, 39, 88, 36, 39, 83, 41, 56, 77, 39, 69, 72, 98, 39, 15, 29, 69, 64, 92, 96, 49, 59, 62, 53, 82, 40, 37, 29, 41], 23, 110);
    console.log(`TEST-3...${result}`);
  
    result = driver([-88, -60, -60, -58, -56, -56, -46, -44, -40, -38, -32, -28, -22, -18, -12, -4, -2, 10, 24, 24, 28, 38, 42, 46, 54, 64, 72, 74, 78, 96, 96], 26, -2200);
    console.log(`TEST-4...${result}`);
  
    result = driver([0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1], 39, 0);
    console.log(`TEST-5...${result}`);
  
    result = driver([1, 4, 6, 9, 10, 12, 17, 17, 18, 21, 22, 26, 26, 31, 32, 33, 34, 39, 42, 43, 45, 46, 48, 50, 53, 53, 54, 55, 60, 61, 62, 63, 63, 64, 70, 70, 70, 71, 71, 78, 86, 88, 91, 92, 95, 95, 96, 97, 99], 28, 27);
    console.log(`TEST-6...${result}`);
  
    result = driver([-42, 44, -80, -60, 48, 66, 54, -76, 26, -74, -10, 46, -50, 42, -26, -24, -14, 36, -2, -26, 16, -10, 20, -88, -78], 19, -1584);
    console.log(`TEST-7...${result}`);
  
    result = driver([0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 5, 0);
    console.log(`TEST-8...${result}`);
  
    result = driver([65, 32, 66, 82, 86, 98, 15, 33, 57, 3, 73, 45, 90, 82, 33, 99, 44, 76, 50, 89, 5, 7, 64], 22, 63);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: minimumCostMakeArraySize1RemovingLargerPairs
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js