2D House Robber Onsite
Anonymous User
772

Got this question:
Given a City laid out on a grid, there are R rows
of houses and C columns of houses. Each house is known to contain some amount
of valuables totaling v_ij. Your task is to rob as many houses as possible
to maximize the amount of loot. However there is a security system in place
and if you rob two adjacent houses an alarm will go off
Find the optimum set of non-adjacent houses to rob.

Houses:            alignment:
      10 20 10     0  1  0
      20 30 20 =>  1  0  1
      10 20 10     0  1  0
This alignment results in the maximum of 80.

Anyone able to solve this?
Comments (2)