ZS Associates Interview Question

How did you solve, how could you've solved it differently.