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.
This code segment
class Solution {
public:
bool isAnagram(string s, string t) {
unordered_set us;
unordered_set us1;
for(auto x : s){
if(us.count(x))
continue;
else
us.insert(x);
}
for(auto x : t){
if(us1.count(x))
continue;
else
us1.insert(x);
}
return us==us1;
}
};
passes all the test cases but this shuold return wrong because strings of type aab and abb are not anagram but this is not included in testing that is why this code segment passes all the test cases
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.
This code segment
class Solution {
public:
bool isAnagram(string s, string t) {
unordered_set us;
unordered_set us1;
for(auto x : s){
if(us.count(x))
continue;
else
us.insert(x);
}
for(auto x : t){
if(us1.count(x))
continue;
else
us1.insert(x);
}
return us==us1;
}
};
passes all the test cases but this shuold return wrong because strings of type aab and abb are not anagram but this is not included in testing that is why this code segment passes all the test cases