FINDING CB NUMBER, CODE NOT WORKING PROPERLY

For the Test Case:
8
81615
Expected O/p = 2
My O/P=1
Please Tell the mistake

The test case is:
5
81615

here is your corrected code

Thank you so much for the assistance,
I understood my mistake. But can you tell me, why I should not use my function to convert string to integer

I tried submitting the updated code, Still not passing all test cases

Can you please reply @aa1
Waiting for your assistance

@babayaga
yeah, you need to initialize array as false

Thank You so much, It worked ! :heart: