You are viewing a single comment's thread. Return to all comments →
Rather simple and concise in Python 3:
#!/bin/python3 def hoursum(arr, r, c): return sum(arr[r - 1][c-1:c+2]) + arr[r][c] + sum(arr[r + 1][c-1:c+2]) arr = [[int(x) for x in input().split()] for _ in range(6)] ans = max(hoursum(arr, r, c) for r in range(1,5) for c in range(1,5)) print(ans)
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 →
Rather simple and concise in Python 3: