Question

Write a function that takes an array and returns the maximum sum of non-adjacent elements?

Login to Submit

Examples

Input: [3, 4, 5, 4, 5, 4, 5, 5]
Output: 18

Input: [5, 5, 3, 3, 5, 3, 4, 3]
Output: 17

Input: [3, 4, 4, 5, 3]
Output: 10