Pregunta de entrevista de Apple

Asked to complete Leetcode style coderpad questions