Apple | Phone | Maximum sum of non adjacent elements
Anonymous User
57028
Jun 23, 2020
Jun 23, 2020
There is unsorted integer array, return a maximum sum of non adjacent elements.
example>
[5, 20, 15, -2, 18] => 20 + 18 = 38
[4, 1, 6, 3, 2] => 4 + 6 + 2 = 12
I never seen this problem in leetcode, anybody pls let me know how to approach this.
- I googled it and the solution seems different when the negative number exists or not.
Comments (52)


