354. Russian Doll

2016-06-17
阅读 2 分钟
3.3k
典型的dp,注意点的程序中已经标出: {代码...}

265. Paint House II

2016-06-16
阅读 3 分钟
3.2k
题目:There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.

256. Paint House

2016-06-16
阅读 2 分钟
2.6k
题目:here are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.

276. Paint Fence

2016-06-16
阅读 2 分钟
2.6k
题目:There is a fence with n posts, each post can be painted with one of the k colors.

343. Integer Break

2016-06-16
阅读 2 分钟
2.7k
题目:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.

300. Longest Increasing Subsequence

2016-06-14
阅读 1 分钟
2.7k
题目:Given an unsorted array of integers, find the length of longest increasing subsequence.

264. Ugly NumberII & 313. Super Ugly Number

2016-06-14
阅读 3 分钟
3.3k
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly numbers.

174. Dungeon Game

2016-06-14
阅读 3 分钟
2.5k
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way through the dungeon to rescue the princess.

221. Maximal Square

2016-06-13
阅读 2 分钟
2.4k
题目:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.