Domanda di colloquio di Rokt

Coding problem similar to easy leetcode question