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.
defsurfaceArea(A):cubemap=set()tot=0foriinrange(len(A)):forjinrange(len(A[0])):forkinrange(A[i][j]):tot+=6# check if any of the 6 adjacent spaces are occupied# remove 2 for each shared facecord=[i,j,k]forainrange(3):forbinrange(-1,2,2):cord[a]+=biftuple(cord)incubemap:tot-=2cubemap.add((i,j,k))returntot
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 →
my simple python sol