We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Sherlock and Anagrams
Sherlock and Anagrams
Sort by
recency
|
1670 Discussions
|
Please Login in order to post a comment
if a string comes repeatedly, you have to increase its counter value, for repeative string: for repeating only once: add 1 to counter for repeating twice: add 2 to counter .... and so on.
def sherlockAndAnagrams(s): # abba -> # a, a # b, b # ab, ba # abb, bba # NOTE: We ignore the full text (abba)
javascript
Solution in Python 3 with Dictionary: https://gist.github.com/ricardo1512/da7a5bf3ae3d1a99f480a15336e3c361
js