[Community Puzzle] 1. NGR - Basic Radar

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Lucasgood,validated by @Nagato_Uzumaki,@Edjy and @JorBer.
If you have any issues, feel free to ping them.

This problem got a problem.
The example said 134 is the only correct acceptable speed as answer.

But there are many possible and equally correct answers:


Not a word in the statement handles this ambiguity.

Yes, I tried rounding down and it passed all tests and validators.

1 Like

Rounding to closest integer works fine too.
But yes it should have been specified.

1 Like

“ordered alphabetically by Plate first, then Speed”

I guessed each plate appears only one time at each radar (it is not said explicitely, and this quote made me hesitate).
I think “ordered alphabetically by Plate” would be enough :slight_smile:

1 Like

Yes, that is my bad. When I validated the puzzle, because of the way it was worded, I thought there would be mulitple passings by the same license plate.
I think it should be changed, but maybe it can’t be changed to include the same plates now that people have already solved it? If so, the statement should be changed to only specify plates, and it should be specified in the statement that there is only unique plates.


In my opinion, option 2.
I think multiple passings by the same car induces useless difficulty. If the problem goes on this road (^^), then we could imagine some twisted paths, like entering two times the radar zone but exiting only once (the other, exit was taken at km 51, to “Aéroport de Valenciennes”).

1 Like

I don’t know if I agree that the raised difficulty would be useless, but I can agree that it is not warranted for this puzzle. Nonetheless, the statement needs to get fixed :slight_smile:

1 Like

Hello guys,
I updated this contributions looking at your opinion and the contribution comment,

Removed the ‘ordered alphabetically by Plate’
Added ‘All speed value will be truncated to integer. ( 137.89 → 137 )’
Reworked the STUB generator

1 Like

It’s not hard.

Hi Lucas,

Nice puzzle, thanks. Just a small thing, and I am late for that, but maybe for next puzzle you should add an example with two plates similar until the last number. Here, while sorting, i can stop to AA-8xx-xx and not bother about the “x”, it will work.
Fun puzzle anyway !

Continuing the discussion from [Community Puzzle] 1. NGR - Basic Radar:

Hi @Lucasgood : will my code be integrated in the next generation of Radar firmware :wink: ?
→ lol, thanks for this good puzzle :+1: !

My code passed all the testcases, but unfortunately it didn’t pass Medium Density Validator and Validator 4. I cannot understand where my mistake is. Is there any chance to check what plates do we have at least for one of these validators?

Send me your code (and the language) in private, I’ll send back what’s wrong.

1 Like

Hi, I think there is an error in the statement:
“All speed value will be truncated to integer. ( 137.89 → 137 )”
Seeing this sentence I used Math.trunc() (in js: " The Math.trunc() static method returns the integer part of a number by removing any fractional digits."), I passed all the tests but not the validator.
I tried after with Math.round() (“The Math.round() static method returns the value of a number rounded to the nearest integer.”) and this time if I passed the validators
Otherwise good puzzle

That is odd. I’ve just checked a dozen of published Python solutions, and all use Math.trunc instead of Math.round. Maybe there are some offsetting issues in your code, which help you pass the validators with Math.round?

If you want, I can send you my code. I looked at several JavaScript solutions, and some of them use Math.round, while others use Math.floor or Math.trunc. However, I don’t think I used some weird speed formula.

Yes, you may PM me your code so I can have a look.

Finding: The order of calculation has an effect on the last validator:

  • both Math.round and Math.floor work in one order,
  • Math.round works but Math.floor fails in another order.

That is unfortunate.