Barclays Interview Question

coding was 4 questions, leetcode mediums