There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more than two adjacent fence posts have the same color. Return the total number of ways you can paint the fence. Note:n and…
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. The cost of pai…
There 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 sam…
原题链接在这里:https://leetcode.com/problems/paint-house-ii/ 题目: 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 n…
原题链接在这里:https://leetcode.com/problems/paint-house/ 题目: There 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 t…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3773 Paint the Grid Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Leo has a grid with N × N cells. He wants to paint each cell either black or white. After he finishe…