Solve the minimum window query problem for an ordered query. The time complexity seems not O(n) as expected in some cases, some more optimization is needed.