category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

Removing Digits, easy

Approach
Sample Implementation ```cpp /* precomputation */ int MAX = 1e6 + 5; vector dp(MAX + 1, (int)1e9); dp[0] = 0; for (int i = 1; i < MAX; i++) { vector tempArr; auto tempNum = i; while (tempNum) { tempArr.push_back(tempNum % 10); tempNum /= 10; } for (const auto &element : tempArr) if (i - element >= 0) dp[i] = min(dp[i - element] + 1, dp[i]); } /* precomputation over */ int n; cin >> n; cout << dp[n] << '\n'; ``` </details>