Maximum number formed after deleting k digits

Used a stack to solve this.
Until the number of digits left and your stack can together make more than n-k digits you can continue popping smaller elements.
Printout the required leftovers of the stack.