Pinterest Interview Question

Hashing-type question with emphasis on time and space complexities