Skip to content

Bug Report for is-anagram #4311

@ks817

Description

@ks817

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.

The space complexity for Hash Map solution is wrong.

Current:
Space complexity: O(1) since we have at most 26 different characters.

Correct:
Space complexity: O(n+m) where n is the length of string s and m is the length of string t.

Explanation: Since we are building two hashmaps countS and countT which potentially store characters up to the size of string s + string t.

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