Intuit Interview Question

Leetcode hard question