Reported August 2024
Googlesorting

Biggest Number of Digits

Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Google OA. Under 2s to a working solution.
Founder's read

Google's August OA asked you to find the biggest number of digits. Sounds simple until you realize the trick isn't arithmetic. You're comparing numbers as strings or reasoning about digit counts in a way that trips up the obvious approach. If you've been thinking raw math, you're already behind. StealthCoder will catch the pattern when you blank on whether to sort, count, or reconstruct the answer in real time.

Pattern and pitfall

The core challenge here is that comparing 'biggest number' by digit count forces you to think about string representation, not numeric value. You might receive a list of numbers and need to return the one with the most digits, or arrange them to form the largest possible number. The pitfall: treating it as a simple max() call misses the lexicographic or custom-sort trick. If you're arranging digits or numbers to maximize the result, you'll need a comparator that isn't the default. This is a string or sorting problem wearing a math costume. StealthCoder handles the custom sort logic so you don't fumble the comparator syntax under live pressure.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Biggest Number of Digits 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 StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as largest number. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Google's OA.

Google 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.

Biggest Number of Digits FAQ

Is this just finding the max digit count?+

Maybe. If the problem is 'return the number with the most digits', it's a one-liner. But Google rarely asks that. Expect a twist like 'arrange these numbers to form the largest possible number' or 'concatenate them smartly'. Read the exact wording twice.

Do I sort by string length or numeric value?+

String length if the goal is digit count. But if you're building the largest number, you need a custom comparator that compares concatenations: if concat(a, b) > concat(b, a), a comes first. That's the non-obvious part.

What if there are leading zeros or edge cases?+

Google OAs usually ignore that, but check the examples. If all inputs are valid integers, you can skip zero-handling. If the result is '000', you might need to return '0'. Read the constraints.

How do I nail the comparator in an interview?+

Write it step-by-step. Compare concat(a, b) vs concat(b, a). Use a lambda or custom function. Test on the example first. Don't guess. StealthCoder will show you the syntax if you blank.

Is there a mathematical trick I'm missing?+

No. This is a sorting problem. The 'math' framing is the trap. Once you identify it's about arranging or counting, the solution is straightforward. Don't overthink.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Google.

OA at Google?
Invisible during screen share
Get it