UBS interview question

Solve a data structure problem and verify the code in github.