filmov
tv
Leetcode 128 - Longest Consecutive Sequence JavaScript

Показать описание
Leetcode 128 asks, "Given an unsorted array of integers, find the length of the longest consecutive elements sequence." In this video I show you three different solutions. The first two perform the algorithm in O(n) linear time. The third solution is a little bit slower, but solves the challenge not using sorting, which makes the problem a little trickier. Definitely worth understanding all three!
Chapters:
0:00 Intro
1:11 Solution using Set and Sort
6:21 Solution without using Set
7:53 Solution without using Set or Sort
12:25 Outro
Chapters:
0:00 Intro
1:11 Solution using Set and Sort
6:21 Solution without using Set
7:53 Solution without using Set or Sort
12:25 Outro