Given a string S and string T, implement a function search(string s, string t) that returns all occurrences of T or T's permutations in S. Assume that characters in S and T comprise of only lower and upper case English letters.
Sigiloso
Setup two integer arrays with length of 52. Iterate through characters in T, count the occurrence of each character and store the frequencies in the array. Iterate the first T.length() letters of S and count the frequency in the other array. From there, increment the new character and decrement the last character until you reach the end of the string S. (Sliding window approach). Time complexity: O(N + M) where N = length of S and M = length of T