Skip to content

Bug Report for permutation-string #4733

@rahme007

Description

@rahme007

Bug Report for https://neetcode.io/problems/permutation-string

The second solution (C++) with a hash table should have s1.length() as its inner loop. Might be present in other coding environment

Image

Corrected

    int need = count1.size();
    for (int i = 0; i < s2.length(); i++) {
        unordered_map<char, int> count2;
        int cur = 0;
        for (int j = i; j < s1.length(); j++) { // corrected the s1.length()
            char c = s2[j];
            count2[c]++;

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