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.
My code is similar but just reversed, and I cannot understand why I'm reversed
test = []
for x in xrange(4):
for y in xrange(4):
m = -100000
total = arr[x][y] + arr[x+1][y] + arr[x+2][y] + arr[x+1][y+1] + arr[x][y+2] + arr[x+1][y+2] + arr[x+2][y+2]
if total > m: m = total
test.append(m)
print max(test)
of course it didn't work. but why not? Am I not taking the top three numbers, then the middle one, and then the bottom three numbers?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
Hi, could you explain why it's
My code is similar but just reversed, and I cannot understand why I'm reversed
of course it didn't work. but why not? Am I not taking the top three numbers, then the middle one, and then the bottom three numbers?