[Community Puzzle] Tricky Number Verifier

A new try today, with a different program. Still the same issue. Could someone give me test validator 2 in pm, because I don’t see how to do it better.
Thx

Send me your code instead, I’ll send back its error.

How should the overflow for incrementing LLL = 999 be handled?

The Output section of the puzzle statement says;

Note: The test cases do not address the issue of an identifier overflow at 999.

Does that answer your question?

No. I wonder how it’s handled beyond the test cases.

Can someone help with validator 6? No idea left, tried even checking if date not greater than today’s.

1 Like

Validator 6 is similar to the “Rejected Identifier” test, where you have to perform the increment step. Maybe your code doesn’t handle that part correctly?

1 Like

Wow, thank you. I used to store incremented value correctly, but for the remainer I thought “well it should only grow by 9” :sweat_smile:

According to the test cases, the incremented LLL value should just be forgotten after using it to calc the new check_digit. Do you mean the check_digit with “the remainer”?
I only fail Validator 6 but pass Test 6.
I think it is either timeout or my increment() is not good in all cases.

Please make Test 6 more similar to Validator 6!

void increment(char *num,const int len){
    if(num[len-1]!='9'){
       num[len-1]++;
    }else{
       for(int i=len-1;i>0;i--){
        if(num[i-1]<'9'){
          num[i]='0'; num[i-1]++; 
          break;
        }
       }
    }   
    return;
}

Edit: The Problem was my increment function. 001–>002 but 199–>299 instead of 200.

I’m not sure what you mean by “forgetting the incremented LLL value”; you should provide an example. Also, you can look at the working of sample 2 in the statement. It shows that the incremented LLL value appears as part of the final social insurance number.