Barclays interview question

A simple DSA question, and Java Questions