A robber enters a colony of houses numbered from 1 to n. Every house has a number printed on the top of it. That number is the amount of money inside that house. However, there is one constraint. If the robber cannot robs from money from consecutive houses. How can the robber maximize his robbery?
If Robber robs from i-th house, he can't rob house no i-1 and house no i+1.
Dynamic Programming logic:
Implementation in Java: