Problem Statement
Removing Digits
Implementation
void solve()
{
ll n;
cin >> n;
vll dp(n + 1, inf);
dp[0] = 0;
FOR(i, 1, n)
{
ll x = i;
while (x)
{
ll d = x % 10;
x /= 10;
if (i - d >= 0)
{
dp[i] = min(dp[i], 1 + dp[i - d]);
}
}
}
cout << dp[n] << "\n";
}