The Trade Desk Interview Question

1h to solve a leetcode hard problem