Question bank › Math
Dsa Math Medium

Digital Root

Calculate the digital root of a non-negative integer n. The digital root is the iterative process of summing the digits of the number until a single digit is obtained. For example, the digital root of 493193 is 4 (4 + 9 + 3 + 1 + 9 + 3 = 29; 2 + 9 = 11; 1 + 1 = 2). Use the digital root formula: dr(n) = 1 + (n - 1) % 9 if n > 0 and dr(0) = 0. Input: A non-negative integer n. Output: The digital root of n. Example: Input: 493193 Output: 4

Key concepts

digitsrootmath

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.