ZS Associates interview question

Fairly straight forward.