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.
#python 3defsurfaceArea(A):# Area of top, bottom, and frontarea=2*len(A[0])*len(A)+sum(A[-1])fori,rowinenumerate(A):#reset h for each rowh=0forj,stackinenumerate(row):#add left edgearea+=abs(stack-h)#add back edgearea+=abs(stack-(0ifi==0elseA[i-1][j]))#update h to current stackh=stack#add right edge of final stackarea+=hreturnarea
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
3D Surface Area
You are viewing a single comment's thread. Return to all comments →