• + 0 comments

    def surfaceArea(A): B = list((zip(*A)))

    def sides(l):
        lst = []
        for i in l:
            l_r = i[0]
            for j in range(1, len(l[0])):
                if i[j] > i[j - 1]:
                    l_r += i[j] - i[j - 1]
            lst.append(l_r)
        return sum(lst)*2
    
    return sides(A) + sides(B) + len(A)*len(A[0])*2