WA in BINSTR

could anyone help me out in finding the bug for the solution of Binary Strings:

https://www.codechef.com/viewsolution/21623009

Thanks in advance.

It would be of great help if anyone could figure out the problem.
I have spend almost a week in this problem.

If you cannot figure out bug in your code, how can you expect others to do it for you? The best way to figure out the bug would be select any accepted code and check the outputs of your code and the accepted code on any random input.If your code is giving same output as Accepted code than check your code for larger inputs.(That can be generated by a program)
Thank You

2 Likes

It would be a great help for anyone tempted to help you, if you could describe the main ideas and structure of your code.

Atmost what i can do for you is to share the testcase generator which i used for solving the same problem.

Rest follow the instruction of @praveen_ojha to figure out the issue with your code.

1 Like

Difference detected in outputs
---------Failed Test Case----------
5 3
11
11
1111010
10
10100
2 2 1000001
1 3 1111100
1 4 101000

---------End of Test Case----------
first difference in line 1
+---+-----------+-----------------------+
| # | wrong.cpp | brute/brute_eight.cpp |
+---+-----------+-----------------------+
| 1 | 4         | 2                     |
| 2 | 1         | 1                     |
| 3 | 3         | 3                     |
+---+-----------+-----------------------+

I have made a cool tool Code_tester to detect such edge cases.

https://github.com/srbcheema1/code_tester

It is easy to install and use.

read the README for more instructions. you will love that tool :slight_smile: