Pergunta de entrevista da empresa SAP

Riddles can be complex sometimes but structure your thoughts your answer does not matter but the approach does