http://leetcode.com/oldoj#question_51