Do All Frequencies Exceed a Threshold?
Updated
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 = 0return = trueNo distinct value violates the requirement.
Constraints
0 <= nums.length <= 200000.-10^9 <= nums[i] <= 10^9.0 <= threshold <= nums.length.
More Google Phone Screen questions
- Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
- Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
- Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
- Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
- Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
- Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
Similar questions at other companies
- Find Unique ElementsCisco · PHONE SCREENCisco interview questions
- Fixed-Range Frequency CountWaymo · PHONE SCREENWaymo interview questions
- Count Pairs with Absolute Difference KAdobe · PHONE SCREENAdobe interview questions
- Frequency Equals Card ValueInMobi · PHONE SCREENInMobi interview questions
- Pair Left and Right Shoes by SizeMotive · PHONE SCREENMotive interview questions
- Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
- Find Valid SET Card TriplesSnowflake · OA · PHONE SCREENSnowflake interview questions
- Best Poker Category with a JokerScale AI · PHONE SCREEN · ONSITE INTERVIEWScale AI interview questions
- Find All Zip Rummy MeldsZip · PHONE SCREEN · ONSITE INTERVIEWZip interview questions
- Most Common Three-Website SequencesAmazon · PHONE SCREEN