Hash what, lol ? :)))
You simply need to alphabetically sort characters in strings and then compare the result.
3
Utilisateur anonyme
24 sept. 2012
think about the time complexity. Whats the time complexity of the sorting? NlogN
And when using hash mapping, it can be only N. Mapping the string to an alphabet array, the index is the char and the value stores the frequency of the char. Hope it helps.
3
Utilisateur anonyme
7 avr. 2015
Just reverse one string and then compare the result with other string.
Utilisateur anonyme
29 juil. 2012
hash
Utilisateur anonyme
2 oct. 2012
easiest way probably to reduce the characters to ascii, add them all together. If values are equal, they all contain the same characters. O(n)