随笔分类 -  Dynamic Programming

摘要:You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return  阅读全文
posted @ 2021-11-01 03:21 苗妙苗 阅读(34) 评论(0) 推荐(0)
摘要: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. Yo 阅读全文
posted @ 2021-11-01 02:31 苗妙苗 阅读(57) 评论(0) 推荐(0)
摘要:[抄题]: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place 阅读全文
posted @ 2018-08-22 04:03 苗妙苗 阅读(149) 评论(0) 推荐(0)
摘要:[抄题]: On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly Kmoves. The rows and columns are 0 indexed, s 阅读全文
posted @ 2018-08-11 15:38 苗妙苗 阅读(321) 评论(0) 推荐(0)
摘要:[抄题]: 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 y 阅读全文
posted @ 2018-08-09 17:47 苗妙苗 阅读(208) 评论(0) 推荐(0)
摘要:[抄题]: You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can fol 阅读全文
posted @ 2018-08-04 15:09 苗妙苗 阅读(310) 评论(0) 推荐(0)
摘要:[抄题]: The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, ea 阅读全文
posted @ 2018-08-03 17:14 苗妙苗 阅读(242) 评论(0) 推荐(0)
摘要:[抄题]: Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1:Input: 阅读全文
posted @ 2018-07-30 18:18 苗妙苗 阅读(256) 评论(0) 推荐(0)
摘要:[抄题]: 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 differe 阅读全文
posted @ 2018-06-04 16:15 苗妙苗 阅读(197) 评论(0) 推荐(0)
摘要:[抄题]: In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. Each subarray will be of size k, and we want 阅读全文
posted @ 2018-05-28 22:02 苗妙苗 阅读(319) 评论(0) 推荐(0)
摘要:[抄题]: Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'. The matching should cover the ent 阅读全文
posted @ 2018-05-24 10:08 苗妙苗 阅读(201) 评论(0) 推荐(0)
摘要:[抄题]: We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in 阅读全文
posted @ 2018-05-18 11:30 苗妙苗 阅读(342) 评论(0) 推荐(0)
摘要:[抄题]: 求挖掉一些区域后,能允许出现的最大十字架 In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. Wh 阅读全文
posted @ 2018-05-18 09:09 苗妙苗 阅读(180) 评论(0) 推荐(0)
摘要:[抄题]: Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Example 2: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空 阅读全文
posted @ 2018-05-15 22:22 苗妙苗 阅读(122) 评论(0) 推荐(0)
摘要:[抄题]: Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee re 阅读全文
posted @ 2018-05-13 22:43 苗妙苗 阅读(152) 评论(0) 推荐(0)
摘要:[抄题]: A message containing letters from A-Z is being encoded to numbers using the following mapping: Given a non-empty string containing only digits, 阅读全文
posted @ 2018-05-08 15:04 苗妙苗 阅读(231) 评论(0) 推荐(0)
摘要:[抄题]: Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes 阅读全文
posted @ 2018-05-07 16:10 苗妙苗 阅读(174) 评论(0) 推荐(0)
摘要:[抄题]: Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. The matching should cover the e 阅读全文
posted @ 2018-05-05 09:15 苗妙苗 阅读(194) 评论(0) 推荐(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 than two adj 阅读全文
posted @ 2018-03-13 20:36 苗妙苗 阅读(273) 评论(0) 推荐(0)
摘要:[抄题]: 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 阅读全文
posted @ 2018-03-13 15:41 苗妙苗 阅读(250) 评论(0) 推荐(0)