r/programmingchallenges • • Sep 27 '15

Help me solve this Fenwick tree problem?

http://wcipeg.com/problem/tc
3 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/bobhob314 Sep 30 '15

Haha, a little complicated for me but there is a 1D solution my teacher told me about where you sort and insert into the tree in sorted order and query each of them like that. Thanks!

2

u/heapHeapArray Sep 30 '15

Now i see it, way simpler!