Recursive Digit Sum
CodeChefOpen on judge ↗
We define super digit of an integer x using the following rules: Given an integer, we need to find the super digit of the integer. • If z has only 1 digit, then its super digit is z. • Otherwise, the super digit of x is equal to the super digit of the sum of the digits of z. For example, the super digit of 9875 will be calculated as: super_digit(9875) 9+8+7+5 = 29 super_digit(29) 2
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start