Skip to content

a-lika/longest-consecutive-sequence

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Longest Consecutive Sequence

Description

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Well, lets assume that this task related only to the sequence with step equal to 1 only.

For example:

Given exampleArray = [100, 4, 200, 1, 3, 2]. The longest consecutive elements sequence is [1, 2, 3, 4].

longestConsecutiveLength(exampleArray) returns the length of the longest sequence - 4.

Attentive!

Your algorithm should have O(n) complexity.

Write your code in src/index.js

Run test locally npm test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%