Pregunta de entrevista de Teya

Leetcode style coding problem of medium difficulty.