title: Minimum Number Subsets Distinct Elements
signature: function minimumNumberSubsetsDistinctElements($ar, $n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($ar, $n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($ar, $n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        array(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));
      
      printf("TEST-1...%s\n",driver(
        array(-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));
      
      printf("TEST-2...%s\n",driver(
        array(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));
      
      printf("TEST-3...%s\n",driver(
        array(16, 38, 38, 41, 47, 48, 48, 48, 49, 62, 84, 92, 99), 6, 
        1));
      
      printf("TEST-4...%s\n",driver(
        array(-88, -64, -40, -38, -38, -16, 16, 20, 28, 40, 56, 58, 60, 68, 74, 92), 12, 
        1));
      
      printf("TEST-5...%s\n",driver(
        array(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));
      
      printf("TEST-6...%s\n",driver(
        array(14, 24, 82, 87, 95), 3, 
        1));
      
      printf("TEST-7...%s\n",driver(
        array(-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));
      
      printf("TEST-8...%s\n",driver(
        array(0, 1, 1, 1), 3, 
        1));
      
      printf("TEST-9...%s\n",driver(
        array(5, 6, 17, 41, 43, 68, 68, 86, 89, 90), 7, 
        1));
      
  }
  
  main();
  ?>
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;
  }