Category: dynamic programming
The Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. …
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 …
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 …
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may …
On a staircase, the i-th step has some non-negative cost cost assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need …