Skip to content

Bug Report for is-anagram #5151

@teaserboy

Description

@teaserboy

Bug Report for https://neetcode.io/problems/is-anagram

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

Incorrect 'Recommended Time & Space Complexity' mentioned in the question.

Here's the current text

Recommended Time & Space Complexity
You should aim for a solution with O(n + m) time and O(1) space, where n is the length of the string s and m is the length of the string t.

If we want to solve this using O(1) space then we cannot do O(n + m) time since sorting the inputs would require worst case O(nlogn + mlogm) time.
If we want to solve it with O(n + m) time then we cannot do O(1) space because building a hashmap takes up O(m + n) space.
If there are other solutions, the video attached does not talk about it.

The attached video does not provide a solutions that correctly aligns with the recommended space and time complexity.

Recommendation:
Reword the recommended time & space complexity to either be
O(n + m) time and O(n + m) space
OR
O(1) time and O(nlogn + mlogm) space
OR
provide a solution in the video that meets the recommended constraints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions