搜索结果
查询Tags标签: Robber,共有 4条记录-
[leetcode] 198. House Robber
题目 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 systems connected and it will …
2022/3/9 23:19:37 人评论 次浏览 -
House Robber的解法
题目链接:https://leetcode.com/problems/house-robber/ 答案自然是动态规划(Dynamic programming,简称DP)。 代码 func rob1(nums []int) int {lth := len(nums)if lth == 0 {return 0}dp := make([]int, lth+1)dp[1] = nums[0]for i := 2; i < lth+1; i++ {dp[i] =…
2022/2/8 23:51:16 人评论 次浏览 -
House robber
198. House RobberMedium 10797236Add to ListShareYou 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 h…
2022/2/4 6:12:25 人评论 次浏览 -
198. House Robber
小偷问题-打家劫舍 这个问题同学面试的时候问到过,作为一道动态规划问题,就整理一下吧。 题目描述 你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被…
2021/5/3 10:57:41 人评论 次浏览