Frequency Equals Card Value
Updated
Problem statement
You are given an integer array deck, where each integer is the value written on one card.
Return true if there is at least one integer x that appears exactly x times in deck. Otherwise, return false.
Function
hasValueWithMatchingFrequency(deck: int[]) → booleanExamples
Example 1
deck = [1,1,1,2,2,3]return = trueThe value 2 appears exactly 2 times, so the condition is satisfied.
Example 2
deck = [1,1,2,2,2,3,3]return = falseThe frequencies of values 1, 2, and 3 are 2, 3, and 2. None equals its card value.
Constraints
2 <= deck.length <= 10^41 <= deck[i] <= 4 * 10^4
More InMobi Phone Screen questions
- House Robber IPHONE SCREEN · Seen Aug 2026
- Word Break IIPHONE SCREEN · Seen Aug 2026
- Bus Station Seat AllotmentPHONE SCREEN · Seen Mar 2026
- Find Missing and Duplicate IntegerPHONE SCREEN · Seen Mar 2026
- Frog Position After T SecondsPHONE SCREEN · Seen Mar 2026
- IPOPHONE SCREEN · Seen Mar 2026
- Evaluate DivisionPHONE SCREEN · Seen Dec 2025
- Compare Version NumbersPHONE SCREEN · Seen Feb 2022
- Count Array DerangementsPHONE SCREEN · Seen Feb 2022
- Maximum Frequency StackPHONE SCREEN · Seen Feb 2022
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
- Pair Left and Right Shoes by SizeMotive · PHONE SCREENMotive interview questions
- Do All Frequencies Exceed a Threshold?Google · PHONE SCREENGoogle 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