I did not understand it

can explain the qus in detail. also provide me hint

@deepak147852
They are not considering 4991 as a CB number.
Instead, 499 and 991 are CB number that can be formed from the above number 4991.
But, we can select only one as the multiple uses of the same character is not allowed and 99 is common to both.It means that no two CB numbers should share a character for example in 4991, if you detect 499 as CB number then you cant use first, second and third character in the 4991 for other CB numbers.

for example In, 994991, if you make 499, the string will not become 991, it’ll still remain 994991, just you wont be able to use 4, 9, 9. To do this question you must take all the substrings of length 1 followed by all the substrings of length 2 and so on and check if they are CB numbers if they are increment the counter and make the character unavailable for next substrings. Please try to code it, If unable to you can ask new doubt again.

could you elaborate me qus in details and aslo provide me hints in step wise.

actually i have pic this ans from chrome. so if you provide me details from basic then it will be banifical for me.
Like:

  1. what qus excatly says ?
  2. provide me efficent algo (as hint)

thanks

@deepak147852
In this question you have to find how many CB numbers you can generate from a given number.
Description of CB numbers are given in the question.

Approach:

  1. check for all sub-strings of the given string of digits, starting from all strings of length 1 and then gradually checking for the strings of increasing size:
    1.1. check if the sub-string is CB number: for this, create a function
    1.1.1. if sub-string is 1 or 0 return false.
    1.1.2. if sub-string is any of the {2,3,5,7,11,13,17,19,23,29}, then return true.
    1.1.3. if sub-string is divisible by any of the {2,3,5,7,11,13,17,19,23,29}, then return false.
    1.1.4. return false

1.2. now if it is a substring:
1.2.1. call a function that marks the index as visited for indexes which are part of that CB number.

1.3. increment the count for CB number.
2. Print the count

Hope, this would help.
If you still have any issue, feel free to ask.
Give a like if you are satisfied.