leetcode
leetcode copied to clipboard
[Bugfix][C++][0242-valid-anagram] Fix wrong iteration of the smap
- File(s) Modified: 0242-valid-anagram.cpp
- Language(s) Used: C++
- Submission URL: https://leetcode.com/problems/valid-anagram/submissions/955359421/
Change summary:
Using smap[i] where 0 < i < smap.size() will insert the key i into the map if such key does not already exist (link)
This is absolutely not what we want.
The fix is to iterate the smap, get the key and compare the value to tmap.