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

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Max Sum Without Adjacent Elements on Interview Code Editor
Sign Up
to access hints and editorial solutions for Max Sum Without Adjacent Elements
Asked In:
  • Epic systems
Click here to start solving coding interview questions