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.
Although I avoided seeing your code but my solution is exactly based upon your algorithm. My code is working for the test cases 0, 1, 6 but it gives wrong answers for the other(with bigger inputs) test cases. I cannot figure out what could be the reason because I am pretty sure all substrings are generated and my check for anagram also seems to work pretty good. I thought it could have been duplicate substrings but that is not possible because the no of anagrams my code gives is less than the actual ones. Had it been a problem of duplicate substrings I think I should have got more anagrams which surely doesnt seem to be the case.What could be the problem??
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Anagrams
You are viewing a single comment's thread. Return to all comments →
Although I avoided seeing your code but my solution is exactly based upon your algorithm. My code is working for the test cases 0, 1, 6 but it gives wrong answers for the other(with bigger inputs) test cases. I cannot figure out what could be the reason because I am pretty sure all substrings are generated and my check for anagram also seems to work pretty good. I thought it could have been duplicate substrings but that is not possible because the no of anagrams my code gives is less than the actual ones. Had it been a problem of duplicate substrings I think I should have got more anagrams which surely doesnt seem to be the case.What could be the problem??