I got the following question: Given a large text and a query string such as "quick fox", return the starting indices of the first word in the query string (in this case, quick) such that all of the words in the query string are at most k apart after that first word. For example, if we have "The quick brown fox is quick...quick fox" and the query is "quick fox" and k = 2, the code should return [1, 20] (which are the indices of quick in the text since quick and fox are at most 2 apart in these two instances- the first instance of quick and then the one after the ellipses). The query string can be of any length. The interviewer wanted me to optimize the code by preprocessing the text first before I did anything so that I didn't have to traverse the entire text every time a user wanted to search with a different query string. I came up with a two pointer like approach, but couldn't figure out the optimization/the best way to do this. I would appreciate if anyone could help me figure this out!