Barclays interview question

c++, algos