Pergunta de entrevista da empresa SAP

A small coding round from leetcode question