title: Difference Between Highest And Least Frequencies In An Array
signature: differenceBetweenHighestAndLeastFrequenciesInAnArray :: [Integer] -> Integer -> Integer
  differenceBetweenHighestAndLeastFrequenciesInAnArray arr n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Integer -> Integer -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: [Integer] -> Integer -> Integer -> String
  driver arr n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME arr n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ([5, 15, 19, 22, 28, 29, 39, 46, 46, 49, 51, 55, 62, 69, 72, 72, 72, 74, 79, 92, 92, 93, 95, 96]) (15) (1) )
  
      printf "TEST-1...%s\n" (driver ([-92, -92, -78, -74, -70, -66, -60, -54, -50, -48, -34, -32, -26, -24, -22, -14, -10, -10, -6, 2, 4, 6, 12, 18, 34, 42, 52, 56, 76, 92, 92]) (30) (1) )
  
      printf "TEST-2...%s\n" (driver ([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, 1, 1, 1, 1, 1, 1, 1, 1]) (24) (0) )
  
      printf "TEST-3...%s\n" (driver ([1, 5, 13, 17, 21, 22, 25, 26, 29, 29, 31, 32, 35, 38, 40, 46, 48, 48, 49, 53, 54, 59, 61, 65, 65, 66, 73, 79, 81, 83, 92, 92, 93, 96, 97, 98]) (29) (1) )
  
      printf "TEST-4...%s\n" (driver ([-70, -34, -32, -30, -14, 80, 86, 90]) (4) (0) )
  
      printf "TEST-5...%s\n" (driver ([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]) (23) (0) )
  
      printf "TEST-6...%s\n" (driver ([9]) (0) (0) )
  
      printf "TEST-7...%s\n" (driver ([10, 42, 70, 94]) (2) (0) )
  
      printf "TEST-8...%s\n" (driver ([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]) (24) (0) )
  
      printf "TEST-9...%s\n" (driver ([3, 4, 7, 8, 10, 15, 15, 17, 22, 26, 49, 55, 60, 64, 76, 79, 80, 84, 90, 92, 95, 96]) (20) (1) )
  
source_py: def difference_between_highest_and_least_frequencies_in_an_array(arr, n):
      arr.sort()
      count = 0
      max_count = 0
      min_count = n
      for i in range(0, (n - 1)):
          if (arr[i] == arr[(i + 1)]):
              count += 1
              continue
          else:
              max_count = max(max_count, count)
              min_count = min(min_count, count)
              count = 0
      return (max_count - min_count)
source_cpp: int difference_between_highest_and_least_frequencies_in_an_array(vector<int> arr, int n) {
    sort(arr.begin(), arr.end());
    int count = 0, max_count = 0, min_count = n;
    for ( int i = 0;
    i < ( n - 1 );
    i ++ ) {
      if ( arr [ i ] == arr [ i + 1 ] ) {
        count += 1;
        continue;
      }
      else {
        max_count = max ( max_count, count );
        min_count = min ( min_count, count );
        count = 0;
      }
    }
    return ( max_count - min_count );
  }