You are viewing a single comment's thread. Return to all comments →
I used a similar approach but dint keep on storing all of the values of hour glass instead just kept on swaping the values incase the value of new hour glass was greater than the previous one.
a = 
for arr_i in xrange(6):
arr_temp = map(int,raw_input().strip().split(' '))
for i in range(4):
for j in range(4):
check_sum = a[i][j]+a[i][j+1]+a[i][j+2]+a[i+1][j+1]+a[i+2][j]+a[i+2][j+1]+a[i+2][j+2]
if check_sum > max_sum:
max_sum = check_sum
why the range(4)? I think it should be the range(len(a)-2) in order to satisfy any size...
The problem specifies the matrix is always 6x6
why it is not working in python3?
any one pls explain.