Intuit Interview Question

leetcode medium hard question was asked.