Lucky Digit
CodeChefOpen on judge ↗
We define "lucky digit" of an integer x using the following rules: If x has only 1 digit, then its lucky digit is x. Otherwise, the lucky digit of x is equal to the lucky digit of the digit-sum of x. Here, digit-sum of a number is defined as the sum of its digits. For example, lucky digit of 9875 will be calculated as: lucky-digit(5879) = lucky-digit(5+8+7+9) = lucky-digit(29) = lucky-digit(
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