Category: dynamic programming
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given …
Dynamic Programming (DP) is one of the very important algorithm in Computer Science. Here is the simplest example of demonstrating the concept of DP if you want to tell …
Find the least number of perfect square numbers (1, 4, 9, 16, 25 …) which sum to the given integer n. For example, given n = 5, return 2 …
After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, …
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most …