Bloomberg interview question

A coding question related to stack.