Pregunta de entrevista de FedEx

Leetcode problem from easy to medium pool