Largest Number
Practice
2.3 (20 votes)
Basic programming
C++
Problem
81% Success 5413 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\)
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
75 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementationMath
Points:10
280 votes
Tags:
ApprovedBasic ProgrammingEasy
Points:10
185 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyImplementationOpen
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
Results
Custom Input
Run your code to see the output