Skip to content

Bug Report for is-anagram #4803

@pranjalsaxena

Description

@pranjalsaxena

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 recommended complexity section of this problem says this

Image

i.e. O(n+m) time and O(1) space.

But you can either use hashmap approach and have O(n+m) time and O(k) space, where k is number of distinct chars
or you can use sorting and have O(nlogn + mlogm) time and O(1) space.

We can't have both O(n+m) time and 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