题目: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 system connected a…
//动态规划查找两个字符串最大子串 public static string lcs(string word1, string word2) { int max = 0; int index = 0; int[,] nums = new int[word1.Length + 1,word2.Length+1]; for (int i = 0; i <= word1.L…
http://poj.org/problem?id=1163 The Triangle Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 32923 Accepted: 19514 Description 73 88 1 02 7 4 44 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the hi…
传送门 Description Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a set of M coins. The video game costs W JDs. Find the number of ways in which they can pay exactly W JDs su…
面试题9.1:有个小孩正在上楼梯,楼梯有n个台阶,小孩一次可以上1阶.2阶或者3阶.实现一个方法,计算小孩有多少种上楼梯的方式. 思路:第4个数是前三个数之和 注意:能不能使用递归,能不能建立一个很大的数组来存储传递的参数(因为可能有空间的限制),要%1000000007防止超出范围 package cc150.recursion_dp; public class GoUpstairs { public static void main(String[] args) { // TODO 自动生成…