Sherlock and Anagrams

  • + 1 comment

    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??