Finish leetcode_514.