Ensure that you are logged in and have the required permissions to access the test.

Largest Number

4.1

34 votes
Stacks, Basics of Stacks, Data Structures, C++
Problem

Given an integer N with D digits without any leading zeroes. Find the largest number which can be obtained by deleting exactly digits from the number N.

Note

  • Return the largest number without any leading zeroes.

Input format

  • First line contains integer N.
  • Second line contains integer K.

Output format

Return the largest number which can be obtained by deleting exactly K digits from the number N.

Constraints

N>01D1060K<D

 

Sample Input
44312
2
Sample Output
443
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
  • The largest possible number is 443.
Editor Image

?