bakuganmaster's blog

By bakuganmaster, 12 years ago, In English

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 )

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By bakuganmaster, 12 years ago, In English

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)

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it