Pergunta de entrevista da empresa Capgemini

Given one code to provide the output. Seems lime the complex one.. Questions on data structure and algorithm