LeetCode: rectangle in histogram, duplicate in list