Temperatures Puzzle Bug

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.

I saw it in javascript and python and I heard it reported that C# is a problem (though I did not see it myself). For C#, outputting a string “0” instead of a variable equal to 0 sometimes causes it to pass, and sometimes not.

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 :slight_smile:

Should be fixed now!

Hello,

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 :slight_smile:
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

Hi I am having this same problem in JavaScript. When I consol.log(‘0’) the failure response is: Found: undefined… Expected: Nothing. And if I were to consol.log(‘zero’) the response is: Found: zero… Expected: 0

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.

1 Like

I tried to write only: console.log(0)
in the last test and it works, so as said above, the problem doesn’t come from here, you print an extra output somehow.