Longest Consecutive Sequence | Leetcode | Medium | Java | O(n)
This is a medium level problem which can be solved even by sorting ( time complexity: O(nlog(n)) ) but this video explains an algorithm to solve this problem in a better time complexity i.e. O(n) by making use of Set data structure. Link to the problem: https://leetcode.com/problems/longest-consecutive-sequence
This is a medium level problem which can be solved even by sorting ( time complexity: O(nlog(n)) ) but this video explains an algorithm to solve this problem in a better time complexity i.e. O(n) by making use of Set data structure. Link to the problem: https://leetcode.com/problems/longest-consecutive-sequence