Finish leetcode_511.