MJay

198 - DP - House Robber 본문

Programming/LeetCode

198 - DP - House Robber

MJSon 2019. 10. 21. 11:21

 

 

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night.

Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.

 

 재미있는 dp 식임 

 

전 2단계 + 현재 값이든 이든, 그냥 바로 전 단계를 보면 된다.

'Programming > LeetCode' 카테고리의 다른 글

338 Bits  (0) 2019.10.22
276 - DP - (문제 잘 읽어야하는 이유)  (0) 2019.10.22
70 - DP - Climbing Stairs  (0) 2019.10.21
256 - DP - Paint House  (0) 2019.10.21
392 - DP - Subsequence  (0) 2019.10.21