Dropbox interview question

It was a Leetcode style code challenge.