Hello. I recently met this problem but can't solve it, please help me solve it.
Given an array of n integers.
There are q queries. Each query gives us a subarray from l to r.
Find the maximum occurrence of a number in the subarray.
(Sorry for my bad English :) )
Auto comment: topic has been updated by giaminh8368 (previous revision, new revision, compare).
You can use Mo's algorithm to solve this problem in O(n sqrt n)