What’s wrong in my code it is giving incorrect ans in 5 test cases https://ide.codingblocks.com/s/172539
please make it correct
Finding CB numbers
It is mentioned in the question that once a character is used in one cb number it cannot be used in another, and in checkIfCBnumber you didn’t check if the number was prime itself i.e it was 2, 3, 5 and so on it should be
counted as CB number.
Since we can use a single character once we want to generate smallest CB number first then greater than greater than those which makes your logic wrong
Here is the link of code with new logic: https://ide.codingblocks.com/s/172552
In this logic we iterate over the length of the string we begin for 1 then 2 and so on. For every length we see that if it possible to generate a CB number from jth index if it possible then we check if it is valid that is no character present has been used before if it is valid then we mark the characters as used and increment the count.