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.
3D Surface Area
3D Surface Area
Sort by
recency
|
430 Discussions
|
Please Login in order to post a comment
You cannot. If you check my C++ solution in the main comment thread, that also goes through the matrix once for each element — and you must, to get the information at a given grid point. But The Nature Doctors analogy applies: my C++ solution is a clean H × W iterations, while yours seems to be H × 4 × W. Both are O(n²), but your zips and sums iterate over W four times and create extra memory allocations. Just a small thing, of course.
Here is problem solution in python java c++ c and Javascript - https://programmingoneonone.com/hackerrank-3d-surface-area-problem-solution.html
python