MEDIUMasked at 1 company

Hand of Straights

A medium-tier problem at 57% community acceptance, tagged with Array, Hash Table, Greedy. Reported in interviews at Google and 0 others.

Founder's read

Hand of Straights is the kind of medium that feels deceptively simple until you're live and realize the greedy trick isn't obvious. Google asks it. You've got an array of integers and need to figure out if you can divide them into consecutive groups. The catch: every group must be the same size, and each element must form a valid straight (like 1-2-3 or 5-6-7-8). Most candidates either try to brute-force it or miss the sorting-plus-greedy pattern. If you blank on the approach during the OA, StealthCoder solves it in seconds invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
57%

Companies that ask "Hand of Straights"

If this hits your live OA

Hand of Straights is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The trap is thinking you need to search or backtrack. The actual solution: sort the array, then greedily form straights starting from the smallest available card each time. Hash table tracks remaining card counts. The moment you try to construct groups without respecting the minimum card, or you sort but then iterate randomly, you hit wrong answer. Most mistakes come from not realizing the greedy choice (always start the next group from the smallest unused card) is provably optimal. If the smallest card can't form a complete straight of the required length, the answer is no. This is a Greedy plus Array plus Hash Table problem that hits candidates who haven't internalized when greedy is safe. During a live assessment, if the logic stalls, StealthCoder surfaces the sorted-then-iterate pattern instantly.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Hand of Straights recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Hand of Straights interview FAQ

Is this actually a medium or does it feel harder?+

Acceptance rate is 57%, which is solid medium territory. The difficulty comes from recognizing greedy is the answer, not complexity of code. Once you see sorting plus iterative group formation, it's straightforward. Most failures are pattern-recognition, not implementation.

Why does sorting matter here?+

Sorting lets you greedily form straights starting from the smallest card. If the smallest card can't form a valid group, no valid partition exists. Without sorting, you're blind to what's actually available and forced into search or recursion.

How do I avoid the off-by-one or group-size mistake?+

Clarify upfront: group size equals array length divided by number of groups. Use a hash table to track card frequencies. Decrement counts as you form each group. If any count goes negative or you can't complete a group, return false immediately.

Does Google still ask this or is it aged out?+

Google is listed as the company asking this. Frequency data is limited in public reports, so treat it as a real ask. It's the kind of problem that stays relevant because it teaches greedy plus hash table patterns used in harder OA rounds.

What's the time complexity I should target?+

O(n log n) for sorting, then O(n) for hash table traversal and group formation. Space is O(n) for the hash table. This is efficient and expected for the medium tier. Brute-force search will TLE on large cases.

Want the actual problem statement? View "Hand of Straights" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.