Bloomberg Interview Question

A coding question related to stack.