Solve the minimum window query problem by using some HashMap to track the latest position of each word.