Pergunta de entrevista da empresa Google

finding the biggest sum of subset in an int array.

Respostas da entrevista

Sigiloso

23 de out. de 2010

No sorting, it takes O(n) time.

1

Sigiloso

16 de jul. de 2010

What are the specifics to this question? Are we asked to find the subset with number of elements k from a superset of size n, that has the largest sum? ... should just sort the set and sum the largest k elements. O(whatever you choose, if you know the range and its small, counting sort, otherwise nlogn)

Sigiloso

18 de jan. de 2011

Just iterate through the array and add positive numbers to the sum. I don't think this was the problem..

Sigiloso

31 de jan. de 2011

Iterate through the subset once and find the two biggest numbers. Add them to get your answer.