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 tried to solve this using numpy lib with python3. it is showing me runtime error. it's working in my jupiter notebook though.!!
import numpy as np
def hourglassSum(arr):
arr1 = np.array(arr)
f=[]
for i in range(4):
for j in range(4):
g= (sum(arr1[i][:j+3])+sum(arr1[i+1][:j+3])+sum(arr1[i+2][:j+3]))
f.append(g)
return max(f)
Cookie support is required to access HackerRank
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 →
i tried to solve this using numpy lib with python3. it is showing me runtime error. it's working in my jupiter notebook though.!!
import numpy as np
def hourglassSum(arr):