Finish leetcode_312.