[Community Puzzle] Barcode scanner

https://www.codingame.com/training/medium/barcode-scanner

Send your feedback or ask for help here!

Created by @GeoConHD,validated by @java_coffee_cup,@selenae and @Trit0r.
If you have any issues, feel free to ping them.

according to https://barcode-coder.com/en/ean-13-specification-102.html the checksum is not calculated as stated in the puzzle.

The problem statement does not explicitely tell you how the checksum was calculated, but instead gives you the way to verify that the barcode is consistent with its checksum.
You can verify that both operations are perfectly consistent with each other: Your link says checksum = -(3*Odd + Even) mod 10 while the statement says 3*Odd + (Even+checksum) = 0 mod 10.

1 Like

how do for the case reversed for example in test 3 and 9 ?

  1. You first decide whether the barcode is correct by checking the guards, the parts, etc.
  2. If something is wrong, you reverse the barcode and check again.
  3. If something is still wrong, you know it is an invalid scan.

ok i will try

i pass all test in IDE but in the validator the test 2 and 4 don’t pass

If you want, you may send me your code via private message here, and I’ll take a look for you.

yes yes i want

If anyone has an issue with Validator 2 (“Ukraine”) or Validator 4 (“Italy”), the following custom cases may help you debug your code:

(1)
Input

10101101110011011000110100111010110001011100101010100111010010001001110100100011101001110010101

Output

7820455585890

(2)
Input

10100011010100111001000101000110010111011011101010100010010011101010000101000010001001110010101

Output

9007498756670