You are viewing a single comment's thread. Return to all comments →
My python sollution`
def hourglassSum(a): ma = -float('inf') for i in range(1,5): for j in range(1,5): top = bottom = 0 for dy in [-1,0,1] : top += a[i-1][j+dy] bottom += a[i+1][j+dy] ma = max(ma,top + a[i][j] + bottom) return ma
Seems like cookies are disabled on this browser, please enable them to open this website
2D Array - DS
You are viewing a single comment's thread. Return to all comments →
My python sollution`