2021
11-17
11-17
C++实现LeetCode(128.求最长连续序列)
[LeetCode]128.LongestConsecutiveSequence求最长连续序列Givenanunsortedarrayofintegers,findthelengthofthelongestconsecutiveelementssequence.YouralgorithmshouldruninO(n)complexity.Example:Input: [100,4,200,1,3,2]Output:4Explanation:Thelongestconsecutiveelementssequenceis[1,2,3,4].Thereforeitslengthis4.这道题要求求最长连续序列,并给定了O(n)复杂度限制,...
继续阅读 >