Finish leetcode_31.