Sorry, I mistyped and had the : in the wrong position. The actual bug is in the spoiler tag of the original comment. Basically, if you are referencing x[-y], you have to check for y to not be 0, otherwise the first element will be used instead of the last one.
that is true, but based on the https://projecteuler.net/problem=11 problem I was working on, that simply didn't matter as you would always be using 4 adjacent values, so going 1,0,-1,-2 is dandy
3
u/IMayBeABitShy Aug 26 '20
Sorry, I mistyped and had the
:in the wrong position. The actual bug is in the spoiler tag of the original comment. Basically, if you are referencingx[-y], you have to check for y to not be 0, otherwise the first element will be used instead of the last one.