What is the mistake?

Hello @agarwalarjit.agarwal,

  1. You need not to check divisibility with every number smaller than num.
    Read point 3 given in the question.

  2. Your code will fail for point 2 mentioned in the question.

  3. stoi() won’t work for numbers greater than the range of int.

  4. Not accounting for the case mentioned in the question i.e.
    CB number once detected should not be sub-string or super-string of any other CB number.
    Solution:
    Use a separate array to mark the index of the detected CB numbers as visited.

  5. As you have to maximize the CB numbers, first check for all sub-strings of length 1 and then increase the size gradually.

For your mistakes refer to the following code:

Hope, this would help.
Give a like if you are satisfied.

please give some hint

Hello @agarwalarjit.agarwal,

The points mentioned in my previous reply are the mistakes in your code.

What hint are you asking for?

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.

what is the mistake?

Hey @agarwalarjit.agarwal
Kindly cross verify your approach with this solution https://ide.codingblocks.com/s/234989

Hello @agarwalarjit.agarwal,

I have corrected your code and specified/point out all the mistakes in your code:

Refer to comments for better understanding.

Let me know if you still face any issue.

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.