The Trade Desk interview question

It was coding round with a weird cache problem.