Pregunta de entrevista de StyleSeat

Leetcode style question, more tricky than technical