Add Digits
A easy-tier problem at 68% community acceptance, tagged with Math, Simulation, Number Theory. Reported in interviews at American Express and 2 others.
Add Digits is an easy problem that shows up in assessments at Google, American Express, and Bloomberg. The 68% acceptance rate masks a trick: the naive simulation approach works, but interviewers care whether you spot the mathematical pattern underneath. If you blank on the number theory insight during your live OA, StealthCoder surfaces a working solution in seconds, invisible to the proctor. This problem tests whether you can move beyond brute force to recognize structure.
Companies that ask "Add Digits"
Add Digits 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 engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.
Get StealthCoderThe straightforward approach is simulation: keep summing digits until you get a single digit. That works and passes all test cases. The hidden pattern is the digital root formula, which connects to modular arithmetic and number theory. The question becomes whether you'll code the loop or recognize that the answer depends on n mod 9 (with a boundary case). Interviewers don't always care which path you take on easy problems, but recognizing the math shows depth. If you hit this live and the loop isn't clicking, StealthCoder delivers both approaches instantly, so you can code with confidence.
Pattern tags
You know the problem.
Make sure you actually pass it.
Add Digits 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 engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Add Digits interview FAQ
Is Add Digits still asked at FAANG?+
Yes. Google, American Express, and Bloomberg all report asking it. At 68% acceptance, it's not a filter problem, but it shows up in phone rounds and online assessments. Most candidates solve it via simulation and move on. It's a warm-up or tie-breaker, not a signal killer.
What's the trick to Add Digits?+
The number theory shortcut is the digital root formula: 1 + (n - 1) % 9 for n > 0. It computes the answer in O(1) time instead of O(log n). Your interviewer may or may not care, but spotting it shows you think about patterns, not just code.
Does the simulation approach get rejected?+
No. Looping and summing digits is correct, clean, and fast enough. Easy problems rarely have hidden rejection criteria. What matters is readable code and correct logic. The math is a nice-to-have, not a requirement.
How does Add Digits relate to the other topics listed?+
It touches all three: simulation is the straightforward loop, math and number theory unlock the O(1) solution. You can pass without knowing modular arithmetic, but understanding the connection shows you see problems as more than code challenges.
What's the biggest mistake on this problem?+
Off-by-one errors in the formula, or forgetting the boundary case (n = 0). Most candidates either simulate correctly or botch the math. The simulation path is safer if you're unsure. Either way, test with small examples: 38, 0, 1, 9.
Want the actual problem statement? View "Add Digits" on LeetCode →