GEICO interview question

One leetcode medium in 60 minutes