Numeric Poker Operations
Reported by candidates from Rippling's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Rippling reportedly served this one in September 2026, and the trap is baked into the rules: ties break right to left, with no sorting. Numeric Poker Operations looks like a card-game toy, but it's really a small enumeration problem dressed up with a custom comparator. You get COMPARE, BEST and WORST operations over five-digit hands, up to 2000 rows. If you're taking this OA in the next day or two, build the comparator first and everything else falls out of it. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the idea here is simple enough to hold in your head.
The problem
A numeric poker hand is a string of exactly five card ranks. Every rank is a digit from 1 through 9, and ranks may be reused without a deck-wide limit. Hand Strength Categories are ordered from strongest to weakest: five of a kind four of a kind full house two pair three of a kind one pair high card A stronger category always wins. When two hands have the same category, compare their original card order from right to left without sorting. At the first different position, the hand with the larger rank is stronger. Identical hands tie. Process each row of operations in order and return one string result per row: ["COMPARE", first, second] compares two complete hands and returns FIRST, SECOND, or TIE. ["BEST", partial] appends ranks until partial has length five and returns the strongest possible completed hand. ["WORST", partial] appends ranks until partial has length five and returns the weakest possible completed hand. Every completion preserves the given prefix. If the input to BEST or WORST already has length five, return it unchanged. Function processNumericPokerOperations(operations: String[][]) → String[] Examples Example 1 operations = [["COMPARE","99999","88888"],["COMPARE","11223","11123"],["COMPARE","12345","12345"]] return = ["FIRST","FIRST","TIE"] The first result compares two five-of-a-kind hands by their ranks. In the second comparison, two pair is listed above three of a kind in this game's category order. The last hands are identical. Example 2 operations = [["BEST","99"],["WORST","99"],["BEST","12345"],["WORST","12345"]] return = ["99999","99321","12345","12345"] Appending three nines produces the strongest completion of 99. Every completion of that prefix has at least one pair, and 99321 is the weakest one-pair completion under right-to-left comparison. Complete hands remain unchanged. Example 3 operations = [["COMPARE","12349","92341"],["BEST","1"],["WORST","1"],["BEST","1234"],["WORST","1234"]] return = ["FIRST","11111","15432","12344","12345"] The first comparison is decided by the rightmost card, so the leading 9 in the second hand does not decide the result. The completion results follow the same category and right-to-left ordering. Constraints 1 <= operations.length <= 2000. Every operation is exactly one valid shape listed above. Every hand or partial hand contains only digits from 1 through 9. COMPARE receives two strings of length 5. BEST and WORST receive one string whose length is between 1 and 5, inclusive. Each appended rank may independently be any digit from 1 through 9.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick: write one function that maps a five-digit hand to a tuple, (category rank, then digits from right to left). Count digit frequencies, sort the counts descending, and map [5], [4,1], [3,2], [2,2,1], [3,1,1], [2,1,1,1], [1,1,1,1,1] to strength. COMPARE is then plain tuple comparison. For BEST and WORST, the missing slots are at most 4, so brute force every completion over digits 1-9. That's at most 9^4 = 6561 hands per query, times 2000 queries, which is fine, and memoizing by prefix makes it cheaper. The pitfall is sorting the hand before the tiebreak, which the problem explicitly forbids. Another one is assuming the best hand just repeats the max digit. Example 3 shows WORST of 1 is 15432, so enumerate instead of guessing greedily. If you freeze on the enumeration, StealthCoder is the hedge during the live OA.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Numeric Poker Operations cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Rippling's OA.
Rippling reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Numeric Poker Operations FAQ
What's the trick in Numeric Poker Operations?+
Reduce each hand to a comparable key: category strength first, then the digits read right to left in original order. Once that key exists, COMPARE is a single comparison and BEST and WORST are just max and min over all completions of the prefix.
Do I need a clever algorithm for BEST and WORST?+
No. At most four slots are open, so there are at most 6561 completions per query. Enumerate them all, score each with your key, and take the max or min. With 2000 operations that's fast enough, and caching by prefix string trims it further.
What's the most common mistake on this Rippling question?+
Sorting the cards before breaking ties. The statement says compare original order from right to left, so 12349 beats 92341 because the last digit 9 beats 1. Sorting destroys that. The second mistake is mis-ordering two pair above three of a kind.
How do I classify a hand cleanly?+
Count each digit, then sort the counts in descending order. [5] is five of a kind, [4,1] four of a kind, [3,2] full house, [2,2,1] two pair, [3,1,1] three of a kind, [2,1,1,1] one pair, and all ones is high card. Follow the order given in the problem exactly.
How should I prepare in 48 hours for this kind of OA?+
Practice writing custom comparators and small brute-force enumerations with frequency counting. Test on the three given examples, then edge cases like a full-length prefix returned unchanged and a one-digit prefix. Check that your key matches the stated category order before anything else.