Longest consecutive sequence | HashMap and Heap | In English | Java | Video_5

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

NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Description:
This question is about finding the longest sequence of consecutive elements in an array.

Question Name:
Longest Consecutive Sequence Of Elements

Question Statement:
1. You are given a number n, representing the size of array a.
2. You are given n numbers, representing elements of array a.
3. You are required to print the longest sequence of consecutive elements in the array (ignoring duplicates).

Note In case there are two sequences of equal length (and they are also the longest), then print the one for which the starting point of which occurs first in the array.

Topic: #HashMap #HashMapAndHeap #ConsecutiveElements #Arrays #LongestSequence

Used #DataStructure: #HashMapAndHeap

#TimeComplexity: O(N)

#SpaceComplexity: O(N) where N is the number of entities added to the hashmap.

--------------------------------------------------------------

More Youtube PlayList:

---------------------------------------------------------------

Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.



We also provide professional courses with live classes and placement opportunities.

.

.

.

Happy Programming !!! Pep it up

----------------------------------------------------------------

#HashMap #HashMapAndHeap #ConsecutiveElements #Arrays #LongestSequence

=================================================================
Рекомендации по теме