title: Minimum Number Subsets Distinct Elements
signature: class Solution {
  
      public Integer minimumNumberSubsetsDistinctElements(ArrayList<Integer> ar, Integer n) {
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.extension: java
question_info.entry_fn_name: minimumNumberSubsetsDistinctElements
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(ArrayList<Integer> ar, Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(ar, n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-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);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(16, 38, 38, 41, 47, 48, 48, 48, 49, 62, 84, 92, 99)), 6, 1);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-88, -64, -40, -38, -38, -16, 16, 20, 28, 40, 56, 58, 60, 68, 74, 92)), 12, 1);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(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);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(14, 24, 82, 87, 95)), 3, 1);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-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);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 1, 1, 1)), 3, 1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(5, 6, 17, 41, 43, 68, 68, 86, 89, 90)), 7, 1);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> ar, Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(ar, n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__