Coding blocks numbers

not able to understand the condition of question

@kumarakash121005 see there are three criteria for CB numbers
0 and 1 are not CB number
2) 2,3,5,7,11,13,17,19,23,29 are CB numbers.
3) the number which is divisible by any above numbers are CB Numbers

Isme do property aur bhi to likhi h niche wo smjh nhi aa rhi

@kumarakash121005 see in below 2 property it is mentioned that if u find cb number bur it cannot form a substring suppose eg is 4991 here there are wo cb numbers u cannot count 2 cb numbers which are substrings like 499 and 991 are both cb numbers but u can only select one

@kumarakash121005 cannot take cb numbers as subsequence eg 481 u cannot take 41 as cb number

Tell me optimised logic for this problem

@kumarakash121005
According to the Problem find the Max CB numbers from the given number.

As to work on substrings of the given number, we will capture the element into the String instead of integer .
The number ‘n’ given is nothing to do with our approach(as on String) but can be useful according to your approach.
Approach is that
Put loop on string that will give substring of every length.
create a function that will return true if the passed number is a CB number otherwise return false.
check if the digit is already part of the any other CB number, create an boolean array said, valid which store which digits till now have a part of any other CB number.
Take a count and increment if a CB number is found.
return or print the count.

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.