Write a function that takes in an array of positive integers and returns an integer representing the maximum sum of non-adjacent elements in the array. If a sum cannot be generated, the function should return 0.
Sample input: [75, 105, 120, 75, 90, 135] Sample output: 330 (75, 120, 135)
We can use a Stack here
Check this Python code.