Pinterest interview question

How would you solve this problem more efficiently?

Interview Answer

Anonymous

8 Sept 2024

The answer was with a hashmap, but I didn't know that at the time.