3D Surface Area
Think in 2D. Then, proceed to 3D.
There are thousands of coding challenges available online, and your time is limited. How should you pick the right one to study? My answer is to choose the one which triggers an allergic reaction inside of you.
Today, I chose the following coding challenge.
I succeeded in solving this question in one try. The secret that I could pull it off is that I observed the problem systematically and cautiously. At first glance, the question looked quite complex because I do not handle 3D geometry every day. So, rather than tacking the original problem head-first, I thought about an equivalent question in 2D and analyzed it as in the following picture.
Gaining the formula for 2D, I became confident that I can handle the 3D version with this knowledge. Here is my note about the original problem.
I could write code out of the above note. It was a good exercise.