Largest 3-Same-Digit Number in String
A easy-tier problem at 69% community acceptance, tagged with String. Reported in interviews at PayPay and 1 others.
You're given a string and need to find the largest number formed by three consecutive identical digits. Sounds trivial until you realize the edge cases: what if there are no three matching digits in a row? What if the string is empty or too short? PayPay and opentext have both asked this. It's marked easy, but the acceptance rate sits at 69%, which means roughly one in three candidates either mishandle the constraints or ship buggy edge-case logic. If you blank on the approach during your OA, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Largest 3-Same-Digit Number in String"
Largest 3-Same-Digit Number in String 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 used it to pass JPMorgan's OA and system design loop.
Get StealthCoderThe pattern is straightforward: iterate through the string, find every occurrence of three consecutive identical characters, extract that digit, convert it to an integer, and track the maximum. The trick isn't the algorithm, it's the edge cases. Empty strings, strings shorter than 3 characters, non-digit characters mixed in, or the absence of any valid triple all need explicit handling. Most failures come from assuming the input is well-formed or forgetting to return -1 when no valid triplet exists. String iteration is your tool. The problem tests whether you code defensively. If you hit this during your assessment and panic on the logic, StealthCoder runs invisibly and delivers the solve path so you move on.
Pattern tags
You know the problem.
Make sure you actually pass it.
Largest 3-Same-Digit Number in String recycles across companies for a reason. It's easy-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 used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Largest 3-Same-Digit Number in String interview FAQ
Is this problem actually easy or are the ratings off?+
The logic is simple, but 31% of submitters fail, usually on edge cases. Strings shorter than 3 characters, missing triplets, and return-value handling trip people up. It's easy algorithmically and hard psychologically because candidates skip careful constraint reading.
What happens if no three consecutive digits are identical?+
You return -1. Most solutions fail here by returning an empty string, None, or 0. The problem expects an integer sentinel. Always check the examples and return type first.
Can the string contain non-digit characters?+
The problem statement doesn't specify. Assume it can. If you iterate and only check digit characters or validate that a character is a digit before comparing, you're safe. Defensive coding wins here.
Do I need a fancy data structure for this?+
No. A single pass through the string with a running maximum is enough. String slicing or manual index tracking both work. The problem tests careful implementation, not algorithm knowledge.
PayPal and opentext both ask this. How does it fit their interview flow?+
It's a warm-up or screening question. Both companies use it to filter for clean code and edge-case awareness early. Pass this and you move to harder problems. Stumble and you signal carelessness.
Want the actual problem statement? View "Largest 3-Same-Digit Number in String" on LeetCode →