Barclays Interview Question

c++, algos