The Trade Desk interview question

1h to solve a leetcode hard problem