MAX_NUM - finding maximum possible number

no tags 

Given a number n, Find out what max possible number you can make by deleting exactly k digits.

T : no of test cases <= 10^3

1 <= no of digits in n <= 10^5. (n might contain leading zeros)

0 <= k <= n

if value of n is equal to k. then just print a new line.


T: no of test cases

T line follow

every line has

n , k


max possible number


1223 2
8756 2

Note that left to right order should be maintained. As in the example given answer is 23 not 32.

hide comments
praveen123: 2013-05-02 06:48:14

@Nnavneetsinha : You are not satisfying condition of deleting exactly k characters. Try some small test cases.
For the most of the test cases , your code is correct

Nnavneetsinha: 2013-05-02 06:48:14

Hey,can you check my code . Id is 8715716.Please provide a hint ,to find the bug.

praveen123: 2013-05-02 06:48:14

@ Gaurav : Try writing a brute force checker, You will surely find out your error.

Gaurav: 2013-05-02 06:48:14

@praveen123: I am getting WA though my code is satisfying given test cases and my test cases. Can you tell me what is wrong in my output? Code ID-8721212

Akhil Rao: 2013-05-02 06:48:14

@praveen123 I was way off. Nice problem. Enjoyed it :)

praveen123: 2013-05-02 06:48:14

@abhinav : 33 , reread the problem statement.
@akhil rao: slightly wrong, So rethinking and generating some test cases yourself might help.
@fringe : I do not believe that you understood the problem. You are ouputting a single value on all the test cases.

Last edit: 2013-02-13 19:05:39
:D: 2013-05-02 06:48:14

You don't have to be tutored. Nobody expect fluent English here. Just don't break it on purpose with "wut", "wit" and the like. It just makes text hard to read, especially when it's on top of other language problems. I honestly don't know why so many people do that here. As for the English itself, start with enabling an automatic error checking in your browser. That's what I do.

Last edit: 2013-02-13 17:54:30
:D: 2013-05-02 06:48:14

Also Fringe, if you're going to make any request of any kind, use English not gibberish.

Mitch Schwartz: 2013-05-02 06:48:14

Finding bugs in your own code is part of the problem solving process.

And only you and the problem setter (and admins, but they wouldn't get involved) can see your submissions.

Sometimes a problem setter will give some hint about why some code fails, but in general it's unreasonable to expect them to do so, especially when a solver gives no indication of doing proper bug-testing, etc. There's also a forum where you may ask for help with debugging; the chance of getting helped could depend somewhat on how popular the problem is (and be sure to read the post "Read this before posting!" by TripleM).

Last edit: 2013-02-13 07:22:12
Fringe: 2013-05-02 06:48:14

i hate spoj.....if u don't know where is your mistake how wud u improve :/

ps: if any one cud tell me wats wrong wid my wud be of grt help -- prob code :8705268!

Added by:praveen123
Time limit:0.407s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64