GoLang Solution For LeetCode Problem: Longest Consecutive Sequence
Solving Longest Consecutive Sequence in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
Problem Description
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
Your algorithm should run in O(n) complexity.
Example:
Input: [100, 4, 200, 1, 3, 2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
See the full details of the problem Longest Consecutive Sequence at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go
Comments
Leave a comment
You are not LoggedIn but you can comment as an anonymous user which requires manual approval. For better experience please Login.