随笔分类 -  Dynamic Programming

摘要:We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime,  阅读全文
posted @ 2021-06-21 08:58 北叶青藤 阅读(85) 评论(0) 推荐(0)
摘要:Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto 阅读全文
posted @ 2021-04-09 23:59 北叶青藤 阅读(53) 评论(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 to max 阅读全文
posted @ 2020-03-15 09:45 北叶青藤 阅读(164) 评论(0) 推荐(0)
摘要:Given an array A of non-negative integers, return the maximum sum of elements in two non-overlapping (contiguous) subarrays, which have lengths L and  阅读全文
posted @ 2020-03-15 08:29 北叶青藤 阅读(242) 评论(0) 推荐(0)
摘要:Given a 01 matrix, find the longest line of consecutive 1 in the matrix. The line could be horizontal, vertical, diagonal or anti-diagonal. Example 1: 阅读全文
posted @ 2019-11-19 04:35 北叶青藤 阅读(209) 评论(0) 推荐(0)
摘要:Assume you have k<=10^5 intervals [a_i, b_i] \in [1,10^18] (some of them may overlap), and you need to choose a set of intervals mutually disjoint suc 阅读全文
posted @ 2019-08-23 15:11 北叶青藤 阅读(472) 评论(0) 推荐(0)
摘要:You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose o 阅读全文
posted @ 2019-08-19 03:51 北叶青藤 阅读(268) 评论(0) 推荐(0)
摘要:In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given 阅读全文
posted @ 2019-07-19 14:32 北叶青藤 阅读(282) 评论(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: "bbbab 阅读全文
posted @ 2019-06-16 06:51 北叶青藤 阅读(107) 评论(0) 推荐(0)
摘要:Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both 阅读全文
posted @ 2019-05-06 00:11 北叶青藤 阅读(300) 评论(0) 推荐(0)
摘要:Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloon 阅读全文
posted @ 2016-07-24 04:29 北叶青藤 阅读(233) 评论(0) 推荐(0)
摘要:Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or 阅读全文
posted @ 2016-07-23 02:51 北叶青藤 阅读(212) 评论(0) 推荐(0)
摘要:Given three strings: s1, s2, s3, determine whether s3 is formed by the interleaving of s1 and s2. Given three strings: s1, s2, s3, determine whether s 阅读全文
posted @ 2016-07-19 02:21 北叶青藤 阅读(172) 评论(0) 推荐(0)
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文
posted @ 2016-07-16 11:21 北叶青藤 阅读(199) 评论(0) 推荐(0)
摘要:Combination Sum | Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to  阅读全文
posted @ 2016-07-05 04:46 北叶青藤 阅读(250) 评论(0) 推荐(0)
摘要:k Sum Given n distinct positive integers, integer k (k <= n) and a number target. Find k numbers where sum is target. Calculate how many solutions the 阅读全文
posted @ 2016-07-05 00:55 北叶青藤 阅读(249) 评论(0) 推荐(0)
摘要:问题: 给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起来。如:[]是匹配的,所需括号个数为 0.([])[]是匹配的, 所需括号个数为 0.((]是不匹配的, 所需最少括号个数为 3.([)]是不匹配的,所需最少括号个数为 2. 分 阅读全文
posted @ 2015-06-25 05:26 北叶青藤 阅读(1166) 评论(0) 推荐(0)
摘要:Question: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways 阅读全文
posted @ 2015-06-24 02:44 北叶青藤 阅读(148) 评论(0) 推荐(0)
摘要:Word Break I 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 dictionar 阅读全文
posted @ 2015-01-26 05:49 北叶青藤 阅读(249) 评论(0) 推荐(0)