[Community puzzle] Next car license plate?

If you want to test custom cases using CodinGame’s IDE, you can do so by enabling EXPERT mode, found under SETTINGS on the left of the puzzle statement.

1 Like

Maybe, but the issue I’m seeing isn’t the 1/1000 offset; What I’m seeing is being off every ~984880 iterations on the license number. Thanks for your input too :-).

Thank you, and thank you for using caps so that I can clearly see what you’re trying to say :slight_smile:

1 Like

My math isn’t the strongest, but being off by one on the wrapping value here would result in being off by two after 999*999 (=998001) wouldn’t it?

I appreciate your suggestions for fixing the code, and what you have done to help me out. Unfortunately I’m using C# and not jerk to write my code :-).

Well, I didn’t use caps so that you could clearly see them; I copied from the buttons themselves, which are labelled in caps! :grin:

1 Like

Incrementing plate number step by step? Please no!!!
These kind of Puzzles just teach Programmers to be inefficient.

My Program now passes all Test and all Validators except V6 with +1 000 000 . Could someone provide test cases that are more similar to V6 than Test6 ?
My Strategy was to first convert the Plate to 3 connected numbers, to keep the original structure but make adding easier.
Then do the adding while n is bigger than 0 and subtract everything from n that you add to one part of the Plate structure. Because I had 3 connected numbers (1 to 26*26)-(1 to 999)-(1 to 676) I managed to handle overflows of the last 2 numbers.
Then I reconvert the structure to a string License plate and put it out.
I also handled edge cases like ZZ->AA transition or 999->001.

Edit: I now tried a completely different approach. I converted the license plate to one number, then added n and then reconverted it to a string. The most difficult part was the reconversion to a string. This approach got my 100% on the Tests and also the Validators.
Thx for the Puzzle!

The issue is usually this.

Try generating more edge cases to thoroughly test your code.

Just a note on something that I was stuck on:

Spoiler

In the +100,000 case if you’re using sscan in a language like Golang. The language will try to interpret the number 010 as octal because it starts with a zero. Threw me for a loop for way too long :sweat_smile:

1 Like