Open karankc23 opened 2 years ago
You are given an integer n. On each step, you may subtract one of the digits from the number.
How many steps are required to make the number equal to 0?
Input
The only input line has an integer n.
Output
Print one integer: the minimum number of steps.
Constraints 1≤n≤106 Example
Input: 27
Output: 5
Explanation: An optimal solution is 27→20→18→10→9→0.
Please assign me this issue in c++ language
You are given an integer n. On each step, you may subtract one of the digits from the number.
How many steps are required to make the number equal to 0?
Input
The only input line has an integer n.
Output
Print one integer: the minimum number of steps.
Constraints 1≤n≤106 Example
Input: 27
Output: 5
Explanation: An optimal solution is 27→20→18→10→9→0.