You are viewing a single comment's thread. Return to all comments →
def surfaceArea(H,W,A): #top & bottom view sides top_bot=2*H*W ans=0 #row wise for row in A: ans+=row[0]+row[W-1] #right and left side of that row for i in range(W-1): ans+=abs(row[i]-row[i+1]) #col wise ans+=sum(A[0])+sum(A[H-1]) #top row side and bottom row side for i in range(H-1): for j in range(W): ans+=abs(A[i][j]-A[i+1][j]) return ans + top_bot
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 →