solve anagrams

https://oj.leetcode.com/discuss/4480/solved-it-with-log-time-space-there
-better-solution-accepted