WHOOP interview question

Programmatically align an arbitrary number of same-size rectangles evenly within a larger rectangle, centered vertically.

Interview Answer

Anonymous

5 Oct 2018

I used Apple's standard top-left coordinate space and wrote some single-responsibility helper functions to do two of the calculations. The main function then used the calculations to construct rectangles in the superview's coordinate space based on the size of the input rectangles, the size of the container, and the number of rectangles requested.