Pattern sliding window. problem 1
if ‘N’ is the length of the string, M is the length of the pattern, if( M >N) it is never possible to find a pattern in string there it can be solved in O(1) time.
Calculating frequencies of pattern would tag O (M) time.
Find the pattern with a string would be O(N), worst case not found. At max each character is added or deleted once from frequency counter which is O( N + N)
Time complexity should be O(N)