Barclays interview question

Pen and paper around coding algorithms