Do All Frequencies Exceed a Threshold?
Problem statement
Given an integer array nums and a nonnegative integer threshold, return true exactly when every distinct value in nums appears strictly more than threshold times.
An empty array returns true because it contains no value that violates the rule.
Function
allFrequenciesExceed(nums: int[], threshold: int) → booleanExamples
Example 1
nums = [1,1,2,2]threshold = 1return = trueBoth distinct values occur twice, which is strictly greater than 1.
Example 2
nums = [1,1,2]threshold = 1return = falseValue 2 occurs only once, so it does not exceed the threshold.
Example 3
nums = []threshold = 3return = trueNo distinct value violates the requirement.
Constraints
0 <= nums.length <= 200000.-10^9 <= nums[i] <= 10^9.0 <= threshold <= nums.length.