Please enter your email address or userHandle.
Given a word pat and a text txt. Return the count of the occurences of anagrams of the word in the text.
txt = forxxorfxdofr
pat = for
Explanation: for, orf and ofr appears
in the txt, hence answer is 3.
txt = aabaabaa
pat = aaba
Explanation: aaba is present 4 times
Complete the function search() which takes two strings pat, txt, as input parameters and returns an integer denoting the answer. You don't to print answer or take inputs.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(26) or O(256)
1 <= |pat| <= |txt| <= 105
Both string contains lowercase english letters.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.