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

Автор bakuganmaster, 12 лет назад, По-английски

Hi guys :)) https://www.hackerrank.com/challenges/task-scheduling

I'm trying to solve this problem using segment tree.

I have an array of numbers , I need to add X from index L to R , and also I have to find maximum member of an array from index L to R (not the same L and R);

n---number of elements of an array; The problem I have here is that I want to answer and update this queries in O(lg(n)) time (lg^2(n) will be also okay ) , not O(n);

Can anyone tell me what is an approach to solve this problem ?

P.S in hackkerrank problem R is always N ....

thanks in advance )

Полный текст и комментарии »

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

Автор bakuganmaster, 12 лет назад, По-английски

Hi guys :)) I found a problem about segment tree that i wasn't able to solve it efficiently :(

How can one update a segment of numbers (adding X from index L to R) and another query is to get a sum on a segment (L,R);

thanks)

Полный текст и комментарии »

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