Pergunta de entrevista da empresa SAP

A leetcode easy question. Dont remember exactly