title: Minimum Number Subsets Distinct Elements
signature: class Solution {
  
      public int MinimumNumberSubsetsDistinctElements(List<int> ar, int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(List<int> ar, int n, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(ar, n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-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
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{16, 38, 38, 41, 47, 48, 48, 48, 49, 62, 84, 92, 99}, 6, 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-88, -64, -40, -38, -38, -16, 16, 20, 28, 40, 56, 58, 60, 68, 74, 92}, 12, 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{14, 24, 82, 87, 95}, 3, 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-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
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{0, 1, 1, 1}, 3, 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{5, 6, 17, 41, 43, 68, 68, 86, 89, 90}, 7, 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
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;
  }