Dsa
Arrays
Warm-up
Longest Consecutive Sequence
Write a function that reads a list of integers from input and determines the length of the longest consecutive sequence of integers. Each integer is provided on a new line. Example input: '100
4
200
1
3
2' --> Output: 4 (the sequence is 1, 2, 3, 4)
Key concepts
arrayssortingsequences
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now