code is in above link
Not working on some test cases
Hi rajat
Basically your code is failing test cases because you are only considering 10 numbers that are given in question as CB number but remember that there are more than them. Like 41 is also a CB number which you have to include in that array. And so there are many more CB numbers that you have to include in that array.
how to find all cb numbers
Hi @Rajat-Sharma-2078329489142103
Intuition :
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.
https://ide.codingblocks.com/s/160219 still not passing all test cases after applying your above formula
You have send a wrong code kindly check it out and send the code corresponding to CB numbers.
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.