It seems that the last test case is failing unpredictably even when given the correct answer. I’ve seen it on my own solutions that used to pass and others have as well.
tried it myself. Got 90% in validation. Then showed it to @_CG_jupoulton and got 100%…
Anyway we noted the bug and we’ll check it asap
Thank god… I spent the night hoping I didn’t just make a fool of myself with forgotten changes to my code
I have the problem for this puzzle too.
I use Java as a language, and I ended up with a lambda which does the job
Optional<Integer> i = Arrays.stream(temps.split(" ")).filter(s -> s != null && s != "") .mapToInt(Integer::decode).boxed() .min(Comparator.<Integer>comparingInt(Math::abs).thenComparing(Comparator.<Integer>reverseOrder()));
Unfortunatly only 5 of the 6 tests pass, while the 6th raises an exception (which it doesn’t when run in Eclipse):
Exception in thread "main" java.lang.NumberFormatException: Zero length string
at java.lang.Integer.decode on line 1162
at java.util.stream.ReferencePipeline$4$1.accept on line 210
at java.util.Spliterators$ArraySpliterator.forEachRemaining on line 948
at java.util.stream.AbstractPipeline.copyInto on line 481
at java.util.stream.AbstractPipeline.wrapAndCopyInto on line 471
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential on line 708
at java.util.stream.AbstractPipeline.evaluate on line 234
at java.util.stream.ReferencePipeline.reduce on line 479
at java.util.stream.ReferencePipeline.min on line 520
at Solution.main on line 19
IMO the cause is the old version for the JVM used: https://www.codingame.com/faq Java Oracle Java 1.8.0_72
That means you’re correctly printing out 0, but also something else after it.
Your solution needs to output exactly what’s expected, nothing less nothing more.
I tried to write only: console.log(
in the last test and it works, so as said above, the problem doesn’t come from here, you print an extra output somehow.