employer cover photo
employer logo

Pergunta de entrevista da empresa VMware

given array of integers. find subsequence that yields highest sum.

Resposta da entrevista

Sigiloso

23 de mai. de 2020

- start from array position 0 go all the way to end of array '\0' - Add the sum of each element with element + 1 position - Keep the sum stored as a int variable. - Check the sum value every time when you iterate thru the array - Now you got the highest sum from the array (but we don't know the position of the elements) - now again iterate, this time check for the position which matches the sum we previously calculate. Please cross check with your solution.