Longest Consecutive Sequence | LeetCode 128 | C++, Java, Python

preview_player
Показать описание

**** Best Books For Data Structures & Algorithms for Interviews:**********
*****************************************************************************

Longest Consecutive Sequence | Leetcode 128
Facebook Coding Interview question,
google coding interview question,
leetcode,
Longest Consecutive Sequence,
Longest Consecutive Sequence C++,
Longest Consecutive Sequence Java,
Longest Consecutive Sequence python,
Longest Consecutive Sequence solution,
128. Longest Consecutive Sequence,

#Programming #datastructures #CodingInterview #LeetCode #Google #Amazon
Рекомендации по теме
Комментарии
Автор

Your teaching style is awesome.
I like our voice 😅

SonuSharma-fchd
Автор

awesome explanation.Just a small clarification.The consecutive sequence can be in any order is true but what if the consecutive sequence has duplicates like for the above example say [100, 1, 200, 1, 10, 4, 0, 3, 8, 2].Here the consecutive sequence is [0, 1, 1, 2, 3, 4] so i need to store the frequency also correct if input has duplicates?

prasantharavindramesh
Автор

Loved the explanation .
Let's say we want to print the LCS, how would we achieve that? Would be interested in the java solution

PEEYUSHKUMARPATHAK
Автор

map/ set creation will also take O(n log n)
right?

inspired_enough_to_grow_up
Автор

Instead of unordered_set, we could have used unordered_map with O(1) lookup or it does not matter?

bestsaurabh
Автор

Arr=[values]
Max=0
for i in Arr:
Maxlen=1
n=i
While n=n+1 in Arr
Maxlen+=1
if Max<Maxlen:
Max=Maxlen
Print(Max)
Pls reply sir will it work

syedabdul