Need help with the Approach

Kindly help me understand the approach for this question, possibly with pseudo code

Hello @rishabhkumardeveloper
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 we are working on String) but can be useful according to your approach.
Intuition to solve this problem:
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.
To put a check if the digit is already a part of the any other CB number, create an boolean array say, valid which store which digits till now has been a part of any other CB number.
Take a counter and increment if a CB number is found.
At the end print the count.
Here for your reference i am attacing the code:

if you have any doubt you can ask here:
Happy Learning !!

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.