• + 0 comments

    I had the same approach. However, wouldn't it be more accurate to call it O(m+n)? The number of queries can exceed the size of the array by a huge factor.