ZS Associates interview question

Nothing such difficult.