Not getting correct output

I have made some changes according to the code you sent. But, I’m still getting wrong output.

Please let me know the issue with the following code.

Code lInk: https://ide.codingblocks.com/s/576605

@parikshitpanwar
your code is counting some indexe twice like in the tesetcase

5
81615
your code is counting 3 CB numbers 5 61 8161, here 61 comes into two numbers hence one of them is not valid.
what you could do is take a visited array and store the indexes whose number you have already taken in total_count.means if any number is valid CB number make visited of all indexes from s to e true so that if you again get a valid number you can check from s to e for that number if any index is already visited

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.