http://www.nxcoding.com/archives/leetcode-daily-838-push-dominoes-conditional-interval-handling