Block interview question

LC easy/medium, not too difficult