title: Minimum Number Subsets Distinct Elements
signature: fun minimumNumberSubsetsDistinctElements(ar: ArrayList<Int>, n: Int): Int {
source_py: def minimum_number_subsets_distinct_elements(ar, n):
      res = 0
      ar.sort()
      for i in range(0, n):
          count = 1
          for i in range((n - 1)):
              if (ar[i] == ar[(i + 1)]):
                  count += 1
              else:
                  break
          res = max(res, count)
      return res
source_cpp: int minimum_number_subsets_distinct_elements(vector<int> ar, int n) {
    int res = 0;
    sort(ar.begin(), ar.end());
    for ( int i = 0;
    i < n;
    i ++ ) {
      int count = 1;
      for (;
      i < n - 1;
      i ++ ) {
        if ( ar [ i ] == ar [ i + 1 ] ) count ++;
        else break;
      }
      res = max ( res, count );
    }
    return res;
  }
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"ar": [1, 2, 5, 8, 16, 21, 21, 22, 23, 26, 26, 27, 27, 29, 31, 33, 36, 37, 37, 38, 42, 45, 47, 50, 57, 58, 60, 60, 62, 63, 66, 66, 76, 84, 84, 88, 96, 99], "n": 25}}, {"idx": 1, "outputs": 2, "inputs": {"ar": [-96, -96, -94, -94, -82, -82, -62, -60, -46, -46, -38, -36, -36, -30, -24, -22, -18, -14, -10, 2, 4, 4, 4, 8, 8, 12, 24, 34, 46, 50, 52, 70, 78, 78, 80, 80, 82, 82, 82, 86, 92, 94], "n": 35}}, {"idx": 2, "outputs": 27, "inputs": {"ar": [0, 0, 0, 0, 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], "n": 34}}, {"idx": 3, "outputs": 1, "inputs": {"ar": [16, 38, 38, 41, 47, 48, 48, 48, 49, 62, 84, 92, 99], "n": 6}}, {"idx": 4, "outputs": 1, "inputs": {"ar": [-88, -64, -40, -38, -38, -16, 16, 20, 28, 40, 56, 58, 60, 68, 74, 92], "n": 12}}, {"idx": 5, "outputs": 22, "inputs": {"ar": [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], "n": 29}}, {"idx": 6, "outputs": 1, "inputs": {"ar": [14, 24, 82, 87, 95], "n": 3}}, {"idx": 7, "outputs": 1, "inputs": {"ar": [-90, -88, -84, -80, -80, -76, -68, -64, -58, -58, -58, -46, -40, -34, -18, -14, -10, 2, 2, 4, 8, 12, 14, 22, 40, 40, 46, 50, 52, 62, 62, 64, 68, 76, 90, 94], "n": 34}}, {"idx": 8, "outputs": 1, "inputs": {"ar": [0, 1, 1, 1], "n": 3}}, {"idx": 9, "outputs": 1, "inputs": {"ar": [5, 6, 17, 41, 43, 68, 68, 86, 89, 90], "n": 7}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(ar: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(ar, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(1, 2, 5, 8, 16, 21, 21, 22, 23, 26, 26, 27, 27, 29, 31, 33, 36, 37, 37, 38, 42, 45, 47, 50, 57, 58, 60, 60, 62, 63, 66, 66, 76, 84, 84, 88, 96, 99), 25, 1)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(-96, -96, -94, -94, -82, -82, -62, -60, -46, -46, -38, -36, -36, -30, -24, -22, -18, -14, -10, 2, 4, 4, 4, 8, 8, 12, 24, 34, 46, 50, 52, 70, 78, 78, 80, 80, 82, 82, 82, 86, 92, 94), 35, 2)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 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), 34, 27)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(16, 38, 38, 41, 47, 48, 48, 48, 49, 62, 84, 92, 99), 6, 1)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-88, -64, -40, -38, -38, -16, 16, 20, 28, 40, 56, 58, 60, 68, 74, 92), 12, 1)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(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), 29, 22)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(14, 24, 82, 87, 95), 3, 1)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-90, -88, -84, -80, -80, -76, -68, -64, -58, -58, -58, -46, -40, -34, -18, -14, -10, 2, 2, 4, 8, 12, 14, 22, 40, 40, 46, 50, 52, 62, 62, 64, 68, 76, 90, 94), 34, 1)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 1, 1, 1), 3, 1)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(5, 6, 17, 41, 43, 68, 68, 86, 89, 90), 7, 1)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: minimumNumberSubsetsDistinctElements
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn