AMMEAT2 problem

Please Help!!
please point out the error in my solution…
i guess mine answer is working fine for every test case.
Submission Id- 2066648
User Id - priyanshuid
Thanks in Advance…

It is because, for N=K=1, your code outputs both 1 and -1.
See http://ideone.com/TtJOB5

2 Likes

ohh… f***… bugs are biggest setbacks…thanks anyway… :slight_smile:

There is a very simple method to overcome such bugs. Try running your code against some very basic test cases (like input of smallest possible size), and if possible, try on some very large test cases as well. Most of the “generic” codes will work on the “generic” test cases. They usually fail, when the input size is the smallest (the very basic ones) or the largest ones. It hardly takes much time to do this.

1 Like

@priyanshuid >> Its not a bug its a feature
:smiley:

1 Like

By “try running your code”, I meant, running it on your local machine, or some online compilers (of course, with non-public visibility of the code)…