Блог пользователя giaminh8368

Автор giaminh8368, история, 17 месяцев назад, По-английски

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 :) )

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
17 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by giaminh8368 (previous revision, new revision, compare).

»
17 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

You can use Mo's algorithm to solve this problem in O(n sqrt n)