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

Sri Hari: Batch-3/Neetcode-150/Added hints#3746

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
neetcode-gh merged 2 commits intoneetcode-gh:mainfromSrihari2222:develop_hints
Nov 23, 2024

Conversation

Srihari2222
Copy link
Collaborator

@neetcode-gh

  • Took 5 hours for this work.
  • Please review it.

Can you suggest the complexity for the problem "Design twitter", as it comes under heap category but the sorting solution also passes greatly for this problem?

Copy link
Owner

@neetcode-ghneetcode-gh left a comment

Choose a reason for hiding this comment

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

Looks good, minor change requested


* Time complexity: $O(m)$
* Space complexity: $O(m)$
* Space complexity: $O(1)$

Choose a reason for hiding this comment

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

Maybe i'm mistaken, but shouldn't the space complexity remain O(m)?

Oh, because the character set is 26. Can we add a note that this is because we only store a limited amount of values in the heap, like in:7a6051c

Someone asked me a question about this the other day so i thought it was worth clarifying.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

The space complexity is O(1) because we store almost 26 elements only in any data structure.

It is a good idea to add that note. I will do that for all articles when I am adding the "Swift" code.

@neetcode-ghneetcode-gh merged commitdf08b81 intoneetcode-gh:mainNov 23, 2024
@Srihari2222Srihari2222 deleted the develop_hints branchNovember 23, 2024 10:59
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@neetcode-ghneetcode-ghAwaiting requested review from neetcode-gh

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
@Srihari2222@neetcode-gh

[8]ページ先頭

©2009-2025 Movatter.jp