Pinterest interview question

Time Complexity and Space Complexity A lot