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 …
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 …
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make …
Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings …
A kangaroo is at one side of the river. There are N springs in the river, each is separated 1 meter, like this: K| . . . . . …