Wrong answer on spoj

THe sample cases give correct answer but wrong answer on submitting.
Code:

1 Like

THe modified code is:

THe modified code is: https://ide.codingblocks.com/s/337500

@rajarshib03
Will get back to you asap.

@rajarshib03
This is the updated code. There were some issues in your code which I have corrected and have also placed comments.

Feel free to revert in case you face any query.
If my answer was able to resolve your query, please mark the doubt as resolved.

1 Like

Thank you, it worked.

In spoj it is being accepted but in coding blocks the last test case is not passing.

@rajarshib03
Check the constraints in the CB Problem. The question might be slightly different.

1 Like

Yes it is working, removed the if-else condition in the solve method.
Thank you.

Welcome! Keep practising.

1 Like

@rajarshib03
Your doubt has been cleared, right?

1 Like

Yes thank you it has been cleared

Can you please tell me why is it (temp-k) and not (temp -1)? @LP18Aug0068