Some logic error?

I wrote a solution just as the problem asked, still wrong answer. Gone over it 4 times.

logic to solve the above problem is:

  • 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.
1 Like

Oh. I missed the 3rd point

Well if your issue has been resolved please close this doubt.

Submitted successfully!