### speedster's blog

By speedster, history, 7 years ago,

problem : in a rooted binary tree with n nodes, each node has a positive value( v(i) ) you need to select k(k<=n) nodes from the tree. if a node is selected you must select all of its ancestors.design a dp algo for maximum possible value of k selected nodes

• +5

By speedster, history, 9 years ago,

How to solve this: given multiple query of type : x l r , we need to find the frequency of x in the range r to l. There are no updation so basically calls out for an offline algorithm .

• +2

By speedster, history, 9 years ago,

How to solve this

• +1

By speedster, history, 9 years ago,

Hello codeforces community . I was stuck in this problem was quite sometime . So decided to view the editorial . LINK . I completely understood the editorial but having a hard time understanding why it works . What is the reason behind this. I'll try to explain the method: — we will start will smallest a[i] and for each a[i] we will run a loop from ( j= 2*a[i] till 2*maximum_element_of_array with increment of a[i] (just like sieve) at each j we will find the number which is JUST less than this j present inside the array .If this number j compares greater than a[i] we will store the result in the variable ans . REFERENCE SOL Thank you . plz help me out :)

• 0

By speedster, history, 9 years ago,

Hey, I want to know the thought process of dynamic programming from highly rated users. Do you always start with recursion ? how do you decide the state of dp ( biggest mystery of my life currently ) .

• +5

By speedster, history, 9 years ago,

I have been trying to solve This problem unable to do it i looked at the solution but can't understand how this why is taking a factor of 2 helping ?

• 0

By speedster, history, 9 years ago,

Recently my topcoder arena stopped working with the message "Unable to launch the application " I tried everything from re-installing the arena to java update to clear cache . nothing worked . Then at last i opened arena.topcoder.com but I don't know how to get my kawigiedit editor to work in it. Any idea ?

• +3

By speedster, history, 9 years ago,

How can we prove this : no of unique outputs to (i*j)%k where i can be any number j and k are known is k/__gcd(k,j);

• -1

By speedster, 9 years ago,

Hello , I was trying to solve O2J ladder for bipartite matching but got stuck in HERE I know this is bipartite matching but I am unable to figure out what would the vertices in set1 represent and similarly what would the vertices in set2 represent . A hint would be appreciated .

• 0