Google interview question

Leetcode Easy - Hard, hashset and dynamic