ndstab's blog

By ndstab, history, 6 weeks ago, In English

Here's the problem : Bitwise Balancing Here's my submission for the code : Code for the problem

The thing is it gives Wrong Answer on Test 11 and that too on the 2577th case in the 11th test. How are we supposed to debug in these situations when I've practically no idea what is the issue.

P.S. : Please help me find any issues with the code. Greatly appreciated!

  • Vote: I like it
  • -8
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

You can run your solution on thousands of little test cases locally. From the message you saw, you already know that you sometimes print a number that is not a solution to the equation.

So, write another program that generates valid test cases and a script to run your solution on all these test cases. Add an assert to check that the number you are about to print satisfies the equation. You'll find a small test case that way.