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.
*i,j=0,0
hsum=list()
maxsum,hrsum=0,0
for i in range(4):
for j in range(4):
hrsum=sum(arr[i][j:j+3])+arr[i+1][j+1]+sum(arr[i+2][j:j+3])
hsum.append(hrsum)
#print(hrsum) for debugg
hrsum=0
print(max(hsum)*)
this is more concise.
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 →
*i,j=0,0 hsum=list() maxsum,hrsum=0,0 for i in range(4): for j in range(4): hrsum=sum(arr[i][j:j+3])+arr[i+1][j+1]+sum(arr[i+2][j:j+3]) hsum.append(hrsum) #print(hrsum) for debugg hrsum=0
print(max(hsum)*)
this is more concise.