Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to how the checks are made it's not exposed, but it's not following the logic. Walking though the s2 string is supposed to subtract the letters from the dict, if the letter is not on the dict we should set the value to -1 not 1. See the values on the dict at the end of a run of anagram2('dogbb','godbbcc') whithout fixing:
d 0
o 0
g 0
b 0
c 0
With the fix:
d 0
o 0
g 0
b 0
c -2
Due to the check returning False if len s1 != s2 this bug does not make the whole def fail, but I think it should be fixed with the proper logic.