Cb number only 3 testcases are running

only 3 test cases are running can you help me and fin where i am going wrong

Hello Nikhil,
I have gone throw your code.the mistakes i found are as

  1. cb number has no relation with prime numbers

    • all numbers that follows below properties are cb numbers
      a) 2,3,5,7,11,13,17,19,23,29 are CB numbers.
      b) Any number not divisible by the numbers in point a( Given above) are also CB numbers.
  2. you are not checking overllapping of cb numbers
    - Ex . In 4991, both 499 and 991 are CB numbers but you can choose either 499 or 991, not both.

I hope you find this helpful
regards
Aman yadav

i have 3 doubts now:

1.in line no 63 why are we doing s.length() -i

2.what is the use of the function is_valid

3.why are we using the k loop

1.why we are doing s.length()-i
it is giving last starting index of substring with length i.
for example
string s=“abcdefg” i=1 then starting index of last string of length 1 will be 6 (7-1) indicating “g”
string s=“abcdefg” i=2 then starting index of last string of length 2 will be 5 (7-2) indicating “fg”
string s=“abcdefg” i=3 then starting index of last string of length 3 will be 4 (7-3) indicating “efg”
2.is_valid() is checking whether there is overlapping or not, if is_valid() is true it means this current answer is not counted earlier so consider it in your answer.

3.why are we using the k loop?
we are using k loop to mark the considered string as included and not to include it in any other substring .

I hope this clears your doubt
regards
Aman yadav