最大公共字符串leetcode-HouseRobber-Problem-LeetCode-:HouseRobber-问题-LeetCode-

时间:2021-07-01 01:23:18
【文件属性】:
文件名称:最大公共字符串leetcode-HouseRobber-Problem-LeetCode-:HouseRobber-问题-LeetCode-
文件大小:2KB
文件格式:ZIP
更新时间:2021-07-01 01:23:18
系统开源 最大公共字符串leetcode HouseRobber-问题-LeetCode- @Faizansayeed28 代码 /** * 问题陈述- 你是一名职业劫匪,计划抢劫街道上的房屋。 每个房子都有一定数量的钱 藏起来,阻止你抢劫他们的唯一限制是相邻的房子有安全系统 连接,如果同一天晚上有两个相邻的房子被闯入,它会自动联系警察。 给定一个非负整数列表,代表每所房子的金额,确定最大金额 今晚你可以在不惊动警察的情况下抢劫多少钱。 */ 导入 java.util.Scanner; /** * @author Faizan Sayeed */ 公开课 HouseRobber { 静态整数缓存[]; // Method1()-递归解决方案 // 时间复杂度 - O(2^n) public static int robM1(int[] A, int i) { if (A == null || A.length == 0) return 0 ; if (A.length == 1) return A[0]; if (i < 0) return 0; int ith_house_is_selec
【文件预览】:
HouseRobber-Problem-LeetCode--main
----README.md(5KB)

网友评论