码迷,mamicode.com
首页 >  
搜索关键字:house robber    ( 848个结果
[LC] 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 yo ...
分类:其他好文   时间:2019-10-27 13:03:52    阅读次数:80
Singer House CodeForces - 830D (组合计数,dp)
大意: 一个$k$层完全二叉树, 每个节点向它祖先连边, 就得到一个$k$房子, 求$k$房子的所有简单路径数. $DP$好题. 首先设$dp_{i,j}$表示$i$房子, 分出$j$条简单路径的方案数, 那么最终答案就为$dp_{i,1}$. 考虑两棵$i-1$房子转移到$i$房子的情况, 分四种 ...
分类:其他好文   时间:2019-10-02 23:15:23    阅读次数:123
递归无限查询上级或者下级
$this->get_array($user['uid'],1); function get_array($user_id,$top=0){ $sql = 'SELECT * FROM ' . tablename('weixinmao_house_userinfo').'where pid=:pid... ...
分类:其他好文   时间:2019-09-30 18:20:26    阅读次数:221
python 将数组中取某一值的元素全部替换为其他元素的方法
这里的问题是在做House Price Prediction的时候遇到的,尝试对GarageArea做log转化,但是由于有些房子没有车库,所以GarageArea = 0,再通过log转化变成-inf了,所以我想把所有-inf的数据全部再转化为0,如题目所示。 除了循环还可以怎么做呢?看下面的代码 ...
分类:编程语言   时间:2019-09-29 23:53:24    阅读次数:579
[Daily Coding Problem 294] Shortest round route with rising then falling elevations
A competitive runner would like to create a route that starts and ends at his house, with the condition that the route goes entirely uphill at first, ...
分类:其他好文   时间:2019-09-19 12:28:16    阅读次数:81
UVA 291 The House Of Santa Claus DFS
题目: In your childhood you most likely had to solve the riddle of the house of Santa Claus. Do you remember that the importance was on drawing the hous ...
分类:其他好文   时间:2019-09-16 09:59:12    阅读次数:99
Leetcode之动态规划(DP)专题-198. 打家劫舍(House Robber)
Leetcode之动态规划(DP)专题-198. 打家劫舍(House Robber) 你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。 给定一个代表每个房屋存放金 ...
分类:其他好文   时间:2019-09-08 20:30:12    阅读次数:96
213. House Robber II
dp 解法 / 转化为 Max(rob(nums[0:n 1]), rob(nums[1:n])) / public int rob(int[] nums) { if (nums.length == 0) { return 0; } if (nums.length == 1) { return nu ...
分类:其他好文   时间:2019-09-07 00:53:25    阅读次数:189
198. House Robber
解法: dp 问题 Java 5行代码 public int rob(int[] nums) { int[] dp = new int[nums.length + 2]; for (int i = 0; i ...
分类:其他好文   时间:2019-09-06 01:18:34    阅读次数:89
LeetCode 1168. Optimize Water Distribution in a Village
题目描述: There are n houses in a village. We want to supply water for all the houses by building wells and laying pipes. For each house i, we can either ...
分类:其他好文   时间:2019-08-27 01:10:29    阅读次数:122
848条   上一页 1 ... 6 7 8 9 10 ... 85 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!