Largest Number
Practice
2.3 (20 votes)
Basic programming
C++
Problem
81% Success 5435 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
Submissions
Please login to view your submissions
Similar Problems
Points:10
69 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementation
Points:10
112 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementation
Points:10
41 votes
Tags:
AlgorithmsSortingString Manipulation
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