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
|
261 Discussions
|
Please Login in order to post a comment
return r % 2 == 0 ? (10*(r/2 - 1) + 1) + (2*c - 2) : 10*((r+1)/2 - 1) + 2*(c-1)
or
return r % 2 == 0 ? 5*r - 11 + 2*c : 5*r - 7 + 2*c
for c++ must convertt the parsing of int to long long variable and also change stoi() to stoll() i got accepted after this
def strangeGrid(r, c): if (r-1) % 2 == 0: first_number = (r // 2) * 10 else: first_number = (((r-1) //2) * 10) + 1 return first_number + ((2 * c)-2)
As always the scala is broken since idiots parse the inputs as ints but then give it a number to parse which is too large to fit inside an int