How to solve this runtime error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

How to solve this runtime error?

I was solving a coding competition question. I encountered this runtime error. This code gives output here but "runtime" or "wrong answer" while uploading the solution 🤦🏻‍♂️. I used hashintnext() but it doesn't work. How to solve this inorder to pass the testcases? For better explanation of the doubt : https://ide.geeksforgeeks.org/CnlU50OSYk https://code.sololearn.com/cwzt3XhB8117/?ref=app

4th Dec 2020, 3:08 PM
Aditya
Aditya - avatar
5 Answers
+ 17
Thanks I got my answer.. https://code.sololearn.com/cqinvQE3G6Is/?ref=app https://code.sololearn.com/cfC0AFyeBlVk/?ref=app But still wondering for a solution with while loop and postfix as -- operater .. But Minho made that to clear! Thanks everyone :)
4th Dec 2020, 4:52 PM
Aditya
Aditya - avatar
+ 16
Yes but I wanted with -- operator 😆 Thanks a lot C-MOON ,Minho 🇰🇷 I appreciate your help ))
4th Dec 2020, 5:03 PM
Aditya
Aditya - avatar
+ 15
Ooh my bad🤦🏻‍♂️ thanks
4th Dec 2020, 5:10 PM
Aditya
Aditya - avatar
+ 14
Ahh that's true but the program needs it..by my understanding ? it may be a case I go wrong..but idk🤷‍♂️ http://arena.siesgst.ac.in/contest/NOV20/problem/NOV20C Please see this question
4th Dec 2020, 3:52 PM
Aditya
Aditya - avatar
+ 6
You have forgotten decrement the h -= 1; Besides I did small changes for clear coding: https://code.sololearn.com/cLmAeW1Nf1Cj/?ref=app
4th Dec 2020, 5:04 PM
JaScript
JaScript - avatar