-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
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
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
Labels
No labels