Problem 220: Contains Duplicate III

https://leetcode.com/problems/contains-duplicate-iii/

思路

易错点

  1. 数据溢出,用 long 存储

    Long 是类,对应 Integer;

    long 是数据类型,对应 int

  2. SortedSet 类用 TreeSet 实现

  3. subSet 方法左闭右开

    所以 rightBound 要加 1

Last updated

Was this helpful?