CB number doubt

only one test case is failing
plzz suggest what i am missing
here’s my code

Hi
Please refer this:


If still not clear with your doubt, do let me know

mam its already correct
i am getting output 2 for 1511
plzz check my code what is missing

??plzz clear my doubt mam

Hi Yatin
I ran your code it has compilation errors.Please solve them first

i have corrected it mam
plzz check it now

?? mam plzz look into it

Hi
7
4153777
For this, your code is giving 6, but that is not possible as 7 can be taken only once(as per question)
May be you should keep some visited array to store previous occurrence of element