0% found this document useful (0 votes)
50 views1 page

Longest Consecutive Sequence - NeetCode

The document outlines a coding problem titled 'Longest Consecutive Sequence' where the goal is to find the length of the longest consecutive sequence of integers from a given array. It specifies that the algorithm must run in O(n) time and provides examples with input and output. Additionally, it includes a list of related problems with varying difficulty levels.

Uploaded by

puneetkumar99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views1 page

Longest Consecutive Sequence - NeetCode

The document outlines a coding problem titled 'Longest Consecutive Sequence' where the goal is to find the length of the longest consecutive sequence of integers from a given array. It specifies that the algorithm must run in O(n) time and provides examples with input and output. Additionally, it includes a list of related problems with varying difficulty levels.

Uploaded by

puneetkumar99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NeetCode 150 ESC Pro

Question Solution Submissions


Status Star Problem Python Difficulty Solution
1 class Solution:
Contains Duplicate Easy
Longest Consecutive Sequence 2 def longestConsecutive(self, nums: Li
3
Valid Anagram Easy
Medium

Given an array of integers nums , return theTwo Sum Easy

length of the longest consecutive sequence of


Group Anagrams Medium
elements that can be formed.

Top K Frequent Elements Medium


A consecutive sequence is a sequence of
elements in which each element is exactly 1
Encode and Decode Strings Medium
greater than the previous element. The elements
do not have to be consecutive in the original
Product of Array Except Self Medium
array.
Valid Sudoku Medium
You must write an algorithm that runs in O(n)
time. Longest Consecutive Sequence Medium

Example 1: Valid Palindrome Easy

Two Sum II Input Array Is Sorted Medium


Input: nums = [2,20,4,10,3,4,5]

Output: 4 3Sum Medium

Container With Most Water Medium


Explanation: The longest consecutive sequence
is [2, 3, 4, 5] .
Trapping Rain Water Hard

Example 2:
Best Time to Buy And Sell Stock Easy

Input: nums = [0,3,2,5,4,6,1,1] Longest Substring Without Repeating


Medium
Characters
Output: 7
Longest Repeating Character
Medium
Replacement
Constraints:
Permutation In String Medium
0 <= [Link] <= 1000

-10^9 <= nums[i] <= 10^9 Minimum Window Substring Hard

Sliding Window Maximum Hard

Valid Parentheses Easy


Console Run Submit
Recommended Time & Space
Min Stack Medium

You might also like