Jane Street interview question

Solved a stack question in front of them