Jump Trading interview question

Implement the optional feature in c++.