You are viewing a single comment's thread. Return to all comments →
My solutions:
def _count_cube(A, i, j): count=2 count+=max(A[i][j]- (A[i-1][j] if i>0 else 0), 0) count+=max(A[i][j]- (A[i][j-1] if j>0 else 0), 0) count+=max(A[i][j]- (A[i+1][j] if i<len(A)-1 else 0), 0) count+=max(A[i][j]- (A[i][j+1] if j<len(A[i])-1 else 0), 0) return count def surfaceArea(A): count=0 for i in range(len(A)): for j in range(len(A[0])): count+=_count_cube(A, i, j) return count # Write your code here
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 →
My solutions: