
dynamic programming
文章平均质量分 70
Lau_r_k
这个作者很懒,什么都没留下…
展开
-
LeetCode 416. Partition Equal Subset Sum
题目: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 subsets is equal. 题目:给出一个非空正整数数组,问是否能将该数组拆分原创 2017-05-01 17:29:37 · 298 阅读 · 0 评论 -
LeetCode 467. Unique Substrings in Wraparound String
题目:Consider the string s to be the infinite wraparound string of “abcdefghijklmnopqrstuvwxyz”, so s will look like this: “…zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd….”. Now we have ano原创 2017-06-19 10:04:01 · 348 阅读 · 0 评论 -
LeetCode 523. Continuous Subarray Sum
题目: Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up原创 2017-06-18 11:41:16 · 447 阅读 · 0 评论 -
LeetCode 264. Ugly Number II
题目:Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the原创 2017-06-01 14:01:49 · 247 阅读 · 0 评论 -
LeetCode 376. Wiggle Subsequence
题目:A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either原创 2017-05-31 22:03:48 · 219 阅读 · 0 评论 -
LeetCode 413. Arithmetic Slices
题目: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic sequ原创 2017-05-17 17:39:42 · 265 阅读 · 0 评论 -
LeetCode 368. Largest Divisible Subset
题目:Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0. If there are multiple solutions原创 2017-05-17 15:58:43 · 275 阅读 · 0 评论 -
LeetCode 322. Coin Change
题目: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 up that amount. If that amount of m原创 2017-05-16 17:02:55 · 483 阅读 · 0 评论 -
LeetCode 486. Predict the Winner
题目:给出一个数组,玩家1和玩家2轮流从数组的两端无放回地抽取一个数字(玩家1先抽),当数组被抽完时计算两个玩家的数字总和,总和数值大者为胜者。现在给出一个数组,预测玩家1能否胜出。 例子: Input: [1, 5, 2] Output: False Explanation: Initially, player 1 can choose between 1 and 2. If he原创 2017-05-02 20:03:19 · 250 阅读 · 0 评论 -
LeetCode 516. Longest Palindromic Subsequence
题目: 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" Output: 4 One possible longest原创 2017-07-04 16:00:42 · 382 阅读 · 0 评论