Google interview question

Two technical phone interviews back to back, Leetcode medium