Max Sum Without Adjacent Elements

Given a 2 * N Grid of numbers, choose numbers such that the sum of the numbers
is maximum and no two chosen numbers are adjacent horizontally, vertically or diagonally, and return it.

Example:

Grid:
	1 2 3 4
	2 3 4 5
so we will choose
3 and 5 so sum will be 3 + 5 = 8


Note that you can choose more than 2 numbers

Interview Code Editor
Hints
  • Hint 1
  • Solution Approach
  • Complete Solution
3149 successful submissions.
Asked In:
  • Epic systems
Click here to jump start your coding interview preparation