![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
#Set
TechJungle
这个作者很懒,什么都没留下…
展开
-
JAVA 数据类型 Set HashSet LinkedHashSet TreeSet
1 HashSet1.1 基本特性HashSet利用hashcode进行查询,可以在O(1)O(1)O(1)时间内完成查询。同时其中元素并没有顺序,其中的元素不可以重复。通过hashCode和equals方法来保证元素的唯一性。根据存储的元素计算出hashCode值,然后根据计算得出的hashCode值和数组的长度进行计算出存储的下标;如果下标的位置无元素,那么直接存储;如果有元素,那么使用...原创 2019-11-28 01:08:10 · 115 阅读 · 0 评论 -
LeetCode Array 287 Find the Duplicate Number
287. Find the Duplicate NumberGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there i...原创 2019-11-18 13:43:24 · 85 阅读 · 0 评论 -
LeetCode Array 128 Longest Consecutive Sequence
128. Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100,...原创 2019-11-17 11:02:20 · 115 阅读 · 0 评论 -
LeetCode Array 217 219 220 Contains Duplicate I II III
217. Contains DuplicateGiven an array of integers, find if the array contains any duplicates.Your function should return true if any value appears at least twice in the array, and it should return f...原创 2019-11-16 14:26:40 · 91 阅读 · 0 评论