Largest Number

4.1

34 votes
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

 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
  • The largest possible number is 443.
Editor Image

?