Pergunta de entrevista da empresa CSC

asked an easy leetcode question