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.
arr = []
for _ in range(6):
arr.append(list(map(int, input().rstrip().split())))
def cube(a):
sum_hourglass = sum(a[0][0:3]) + a[1][1] + sum(a[2][0:3])
return sum_hourglass
def area(arr):
cubes=[]
for i in range(4):
y = [arr[i][0:3], arr[i+1][0:3], arr[i+2][0:3]]
cubes.append(y)
return cubes
def area2(arr):
cubes2 = []
for i in range(4):
y = [arr[i][1:4], arr[i+1][1:4], arr[i+2][1:4]]
cubes2.append(y)
return cubes2
def area3(arr):
cubes3=[]
for i in range(4):
y = [arr[i][2:5], arr[i+1][2:5], arr[i+2][2:5]]
cubes3.append(y)
return cubes3
def area4(arr):
cubes4=[]
for i in range(4):
y = [arr[i][3:6], arr[i+1][3:6], arr[i+2][3:6]]
cubes4.append(y)
return cubes4
def oracle(arr):
answer=[]
area(arr)
for i in area(arr):
answer.append(cube(i))
area2(arr)
for i in area2(arr):
answer.append(cube(i))
area3(arr)
for i in area3(arr):
answer.append(cube(i))
area4(arr)
for i in area4(arr):
answer.append(cube(i))
print(max(answer))
oracle(arr)
area(arr)
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 →
Python
area(arr)