Error! Can't find out!
Hey @sanya2508 ,
Can you explain to me a few statements of your code:
- What are you trying to achieve here? Can you please explain the logic?
stringstream cb(l);
int k=0;
cb>>k;
-
It is actually skipping the CB numbers:
Example:
11
44166181111
If you would print s, 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.
Like in the example mentioned, 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. -
What is the purpose of the following?
if(s=="11") return true;
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.