Doubt in question

sir, i was trying a question in leetcode. the question was ‘Count the Number of Consistent Strings’. i have written a code for it, which passes all test cases except one. i am not able to understand the output in this test case. here are the links:

question:

code:

I don’t want the correct solution, i want to know the error.

pls reply as soon as possible

The reason your code doesn’t work is because you are using binary search on an unsorted array.
You can use sort(allowed.begin(), allowed.end()) and then your code works.

oh okay sir, thank you

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.