Pregunta de entrevista de Samsung Research America

Medium question from Leetcode - codility test