We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Strange Grid Again
Strange Grid Again
Sort by
recency
|
252 Discussions
|
Please Login in order to post a comment
c#
public static long strangeGrid(int r, int c)
I have a complain about some of this challenges, because it says "Change the function bla" and even so if you change only that function is impossible to solve, because the error is in the code they already gave you. For example in this one strange grid again, some values are over the integer but the input is set like that on the part you are NOT supposed to alter. So in other words if you where only allowed to change what they said. it cannot be solved. (the function will be correct but the result will be incorrect) You reallyput that you may need to change really all or, something allike or not make that mistakes.
Pyton
return (5*r-5+2*(c-1)) if r % 2 == 1 else (5*r-9+2*(c-1))
Here is my Haskell solution
I enjoyed this because it took mathematical reasoning then some manipulation to come up with an algebra one liner. Looking at other people's solutions there look to be a lot of different formulae that work!