http://www.nxcoding.com/archives/leetcode-daily-135-candy-greedy-algorithm