Solace Interview Question

the question on stacks