Largest Number
Practice
2.3 (20 votes)
Basic programming
C++
Problem
81% Success 5443 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given an integer \(N\) which has \(D\) digits. You have to delete exactly \(K\) digits in integer \(N\).
Find out the largest possible number which can be built from \(N\) after removing exactly \(K\) digits.
Input Format:
- First line contains two space separated integers \(N\) \(K\).
Output Format:
Print the largest possible number which can be built from \(N\) after removing exactly \(K\) digits.
Constraints:
\(1 \le N \le 10^{18}\)
\(1 \le K \le 3\)
\(K \le D\)
Sample Input
3412 1
Sample Output
412
Explanation
After removing exactly \(1\) digit, we can make
- 412
- 312
- 342
- 341
Among, them \(412\) is the largest possible number.
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:10
12 votes
Tags:
StringBasic ProgrammingImplementation
2.The Dice
Points:10
83 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:10
156 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor