Given two strings return if one of 's permutations is the substring of .
The brute force method is to compute the permutations of s1 and check if any of them are a substring in s2 but this will obviously result in a TLE.
The more optimized solution I found was comparing the frequency of characters in and the window in . We iterate through and compute the frequency of the substring created from the sliding window and comparing if the frequency dictionaries are the same.
There is a more efficient solution with comparing the matches and not recomputing frequencies (instead just updating one frequency dictionary). We can make this solution into a solution by updating the frequency dictionary instead of recalculating it from scratch.