How can I remove a certain number of digits in a number so the number obtained is minimal?
Specifically, I want to write a function int remove_digits(int large, int num_digits_to_remove)
such that:
- Any
num_digits_to_remove
digits are removed fromlarge
as though removing characters from its string representation - The number that is returned has the lowest possible value from removing digits as in step 1
For example, removing 4 digits from 69469813
would give 4613
I would prefer answers written in C.