Skip to content

Bug Report for is-anagram #4400

@Zipfer

Description

@Zipfer

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.

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.

Hint 3
We can just consider maintaining the frequency of each character. We can do this by having two separate hash tables for the two strings. Then, we can check whether the frequency of each character in string s is equal to that in string t and vice versa.

Creation of two Maps is not O(1) space.

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