http://www.nxcoding.com/archives/leetcode-daily-2597-number-of-beautiful-subsets