Skip to content

Longest Consecutive Sequence LeetCode problem #9686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cc60085
Longest Consecutive Sequence Leet code Prooblem in python
Sarthak950 Oct 4, 2023
66aa0a6
change the formatting in the explanation
Sarthak950 Oct 4, 2023
2e406a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 4, 2023
dcf7fa0
Update data_structures/arrays/longest_consecutive_sequence.py
Sarthak950 Oct 5, 2023
0ec6a75
Merge branch 'TheAlgorithms:master' into master
Sarthak950 Oct 5, 2023
5baa500
removed the function from the class and fixed the indentation #9686
Sarthak950 Oct 5, 2023
7484018
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 5, 2023
0a5eb1b
converted function name from CamelCase to snake_case
Sarthak950 Oct 5, 2023
92c70f5
added the docktest for the solution
Sarthak950 Oct 5, 2023
4db5841
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 5, 2023
ca07301
removed an accidental error
Sarthak950 Oct 5, 2023
708966e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 5, 2023
d10a45f
Solved some linter errors
Sarthak950 Oct 5, 2023
9d2e88e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 5, 2023
56fbcbe
added the return type
Sarthak950 Oct 5, 2023
37ec51a
argument hint
Sarthak950 Oct 5, 2023
ca3192f
List - list
Sarthak950 Oct 5, 2023
fae996c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 5, 2023
afaa185
fixed the indentation in the doctests string
Sarthak950 Oct 5, 2023
f5fa312
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update data_structures/arrays/longest_consecutive_sequence.py
removed the class from the solution

Co-authored-by: Chris O <[email protected]>
  • Loading branch information
Sarthak950 and ChrisO345 authored Oct 5, 2023
commit dcf7fa0fb8bc36698b78422aa01c1f91445ac1b3
1 change: 0 additions & 1 deletion data_structures/arrays/longest_consecutive_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from collections import defaultdict


class Solution:
def longestConsecutiveSequence(self, nums: List[int]) -> int:
# Create a map of all numbers in the array to their index

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An error occurred while parsing the file: data_structures/arrays/longest_consecutive_sequence.py

Traceback (most recent call last):
  File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
    reports = lint_file(
              ^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 10:5.
parser error: error at 9:4: expected one of (, *, +, -, ..., AWAIT, EOF, False, NAME, NUMBER, None, True, [, break, continue, lambda, match, not, pass, ~

        # Create a map of all numbers in the array to their index
    ^

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An error occurred while parsing the file: data_structures/arrays/longest_consecutive_sequence.py

Traceback (most recent call last):
  File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
    reports = lint_file(
              ^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 10:5.
parser error: error at 9:4: expected one of (, *, +, -, ..., AWAIT, EOF, False, NAME, NUMBER, None, True, [, break, continue, lambda, match, not, pass, ~

        # Create a map of all numbers in the array to their index
    ^

nmap = defaultdict(int)
Expand Down