Sort the Strings Challenge

My code is giving correct output but not passing any test case on hackerblocks

Ques-https://hack.codingblocks.com/app/practice/6/1042/problem

My code–>https://ide.codingblocks.com/s/650973

Please reply someone.

hi @ujj1804_1156aee80205d0bf
try this -->

SIr this code is giving wrong output but got submitted with all test cases correct why ? Also in line 17 of this code shouldn’t p be initialized with 1 ?

hi @ujj1804_1156aee80205d0bf
i am unable to understand what u are saying… the code i sent u is correct… try to dry run for better understanding…

Sir the input is this,
3
92 022
82 12
77 13
2 false numeric

Sample Output
82 12
77 13
92 022

But the the code u sent doesnt give this output because to get the sample output, in the line 17 of your code p must be initialized as 1 and not zero, But this code got submitted on hackerblocks which i am not able to understand how .

The code i sent was from lecture only and showing right output but not getting submitted.

Sir i think maybe there is some problem in hackerblocks for this question , sir is my code correct bcz its giving right output ?

hi @ujj1804_1156aee80205d0bf
yes, i got ur point… i was making small error in my code by starting it with p = 0…
so i am starting with p = 0 only, just instead of multiplying by p, i am now multiplying with pow(10,p)…
corrected code -->


Hope it now clears ur doubt…

Yes sir, doubt clear , i did a small mistake in my code , thanking you sir.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.