You are viewing a single comment's thread. Return to all comments →
I think python solution is simple and consume less memory space
print(max([sum(arr[i-1][j-1:j+2] + [arr[i][j]] + arr[i+1][j-1:j+2]) for j in range(1, 5) for i in range(1, 5)]))
Nice one liner!