Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add 0128-longest-consecutive-sequence.c#2100

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
a93a merged 1 commit intoneetcode-gh:mainfromseinlin:128
Jan 21, 2023
Merged

Conversation

seinlin
Copy link
Contributor

Important

Please make sure the file name is lowercase and a duplicate file does not already exist before merging.

@seinlin
Copy link
ContributorAuthor

seinlin commentedJan 20, 2023
edited
Loading

From the runtime point of view, this is not the best solution. But According to the official solution, using hash map will be considered as O(n).
With uthash, the runtime is poorer. It is a little surprise.
https://leetcode.com/problems/longest-consecutive-sequence/submissions/881518697/
With sorting, O(nlogn), the runtime is the best.
https://leetcode.com/problems/longest-consecutive-sequence/submissions/881543929/

@a93a
Copy link
Collaborator

Thanks, looks good! If you wish, you could add both solutions on your file and separate them with comments, before merging?

Sometimes, runtimes on Leetcode is not very accurate, also there could be specific testcases which will worsen a runtime by lot.

@a93aa93a merged commitb0978b6 intoneetcode-gh:mainJan 21, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@seinlin@a93a

[8]ページ先頭

©2009-2025 Movatter.jp