476
1 Like

DSA Crash Course [Part 79] - Non Adjacent Sum Approach

In this lesson, Alvin explores the strategy to solving the following interview problem:

Write a function, non_adjacent_sum, that takes in a list of numbers as an argument. The function should return the maximum sum of non-adjacent items in the list. There is no limit on how many items can be taken into the sum as long as they are not adjacent.

For example, given: [2, 4, 5, 12, 7]

Th