Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
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-gh neetcode-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

@@ -609,7 +609,7 @@ class Solution {
### Time & Space Complexity

* Time complexity: $O(m)$
* Space complexity: $O(m)$
* Space complexity: $O(1)$
Copy link
Owner

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
Collaborator Author

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-gh neetcode-gh merged commit df08b81 into neetcode-gh:main Nov 23, 2024
@Srihari2222 Srihari2222 deleted the develop_hints branch November 23, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants