Pergunta de entrevista da empresa Intel Corporation

How would you solve a following code.