The Trade Desk Interview Question

It was coding round with a weird cache problem.