T-Mobile Interview Question

leetcode m to hard question