Please debugg my code
Hi @sattyrajpoot39, there are 2 areas needed to be worked upon in your code:
-
CB numbers are what they are as specified in question, so please judge wether a number is cb no. or not acc to criteria given in question. Nothing to do with prime numbers.
-
It is given in the question that no 2 CB numbers shall overlap each other. For a moment consider 816 and 161 are CB numbers. Now for given input les say:
81615
you can only consider 816 or 161 in your final answer but not both, this is because their parts are overlapping, which has been strictly denied in the question. So acc to question, only 816 or 161 should be considered in final ans but your algo will consider both of them and increment ans by 2. So you need to keep a check on which digits have been used in previous CB numbers that have been took into consideration so that you generate and judge the next number based on availability of digits.
Hope this helps 