Welcome to another coding interview test question. Can you crack this one? Post your answer in any programming language or pseudo-code in a gist and share it in the comments below!
Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be
[2, 4, 6, 2, 5]should return
13, since we pick
[5, 1, 1, 5]should return
10, since we pick
Follow-up: Can you do this in O(N) time and constant space?