Hand of Straights
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You hold a hand of cards given as an integer array hand, where hand[i] is the value on card i (values may repeat). You want to split the entire hand into groups of exactly group_size cards, where each group consists of group_size consecutive values, such as [3,4,5].
Every card must belong to exactly one group. Return true if such an arrangement exists, and false otherwise.
Examples
Constraints
- 1 <= hand.length <= 10^4
- 0 <= hand[i] <= 10^9
- 1 <= group_size <= hand.length
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.