employer cover photo
employer logo

Pregunta de entrevista de VMware

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

Respuesta de la entrevista

Anónimo

23 may 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.