Skip to content

Conversation

jnerin
Copy link

@jnerin jnerin commented Nov 19, 2018

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants