"2 test case not passed"
Hello @parasjain011999,
Example:
11
44166181111
If you would print num, then you would realise that your code is initially checking for all the subarrays/substrings that are starting from index i=0. And after detecting a CB number, it makes i=j. Correct?
Like in the example mentioned in my previous reply, it detected two CB numbers though actually there were 4 CB numbers:
Detected CB numbers:
44166181
11
Actual:
41
61
11
11
Solution:
- Check for all the substrings starting from smallest size i.e. 1, then gradually increase the size.
- Also, use an array to mark the indexes that are used in the CB numbers that are already detected.
I have modified the code, you can check:
Hope, this would help.
Give a like, if you are satisfied.
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.