Jan 6, 2009

Find the subvector with the sum closest to 0 , whats the best algorithm [O(nlgn)] you can design for this ?

Find the subvector with the sum closest to 0 , whats the best algorithm [O(nlgn)] you can design for this ?

Use prefix sum array, you should consider the first element
So after you get the minimum pair, you should compare it with a[0]…

No comments:

Post a Comment