Barclays interview question

Least recent cache. leet code (medium)