ZipRecruiter interview question

Leetcode easy, asked about optimization and time/mem complexity