https://www.codingame.com/training/easy/flip-the-sign
Send your feedback or ask for help here!
Created by @Q12,validated by @Djoums,@LastRick and @Sinek.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/easy/flip-the-sign
Send your feedback or ask for help here!
Created by @Q12,validated by @Djoums,@LastRick and @Sinek.
If you have any issues, feel free to ping them.
Test 6 (and probably Validator 6) exceed constraints for this puzzle 2 ≤ height ≤ 10, 2 ≤ width ≤ 10. Be prepared for height & width up to 100.
Fixed, the max is 90/60 it’s not that bad.
I’m stuck here.
I already passed the tests, but I’m failing in the validators 2 and 6.
Is there any reason how these are different?
OK, I guess I had to stop the search as soon as it was clear the the sequence wasn’t correct.
I guess I was getting a timeout.
I made a logical error, but was only punished for that in validator 6 (I passed all tests). I could only find my error by looking to the contribution (and that should not be the case).
My approach: I took all values corresponding ‘X’, and turned them in 1 or -1 depending on above or below zero. Then, I tested whether the minimum of every second value differed from the minimum of every second + 1 value (values[::2] versus values[1::2]) - assuming that for one of them the minimum should be 1 and the other -1. That works for all test cases. Only in validator 6 there is a case in which the minimum of those two sets differ, but the maxima are the same. (min(values[::2]) != min(values[1::2], BUT max(values[::2]) == max(values[1::2]). Maybe this scenario should be in the corresponding test as well.