Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I solved the puzzle in my head before getting to the second paragraph in the article. Here's the reasoning:

1) The area of a circle has a fixed ratio to the area of a square inscribed in that circle.

2) Therefore the volume of a cylinder has a fixed ratio to the volume of a square box of the same height, which sits inside that cylinder.

3) Therefore the biggest cylinder corresponds to the biggest box that can fit inside the sphere.

4) That box is obviously a cube, because what else could it be?

5) If a cube is inscribed in a unit sphere centered at the origin, the corners have coordinates ±1/√3, ±1/√3, ±1/√3.

6) Now you can calculate the volume of the cylinder in your head. Do it!



Step 4 seems a bit glib... :)

It would follow straightforwardly if we knew that the largest rectangle in a circle is a square.

The easiest way I can think of right now to see this is by Lagrange optimization (which we could also apply just as well directly to the 3d problem): the area of a rectangle of width and height <x, y> has a gradient of <y, x>, which can only be normal to the circle (which has normal vector <x, y>) when x = y.

Another way is to think of <x, y> as proportional to <cos(t), sin(t)>; the area is then cos(t) * sin(t), which is proportional to sin(2t), and thus clearly maximized when x = y.


Congrats! But I hope all that is a humblebrag, not a reflection of your standards as a technical interviewer ;-)


Yeah, that was definitely a brag, nothing humble about it :-)

When I was a bit younger, I was in fact the typical asshole interviewer who would ask lambda calculus questions. Now I mostly stay away from interviewing, because I can emphasize much more with the pressure that candidates feel.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: