
c++
文章平均质量分 70
Lau_r_k
这个作者很懒,什么都没留下…
展开
-
Leetcode 494. Target Sum Add to List
题目: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 one from + and - as its new symbol. Find原创 2017-03-09 20:02:42 · 556 阅读 · 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 评论 -
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 410. Split Array Largest Sum
题目:给出一个由非负整数组成的数组和整数m,把该数组切分成m个非空连续子数组,并最小化m个子数组总值最大值。 注意:1 ≤ n ≤ 1000,1 ≤ m ≤ min(50, n) 其中n为数组长度。 例子: 输入:nums = [7,2,5,10,8] m = 2 输出:18 解题思路:显然,无论怎么切分数组,各子数组的总值中的最大值不小于数组中最大的元素。那么原创 2017-04-16 20:41:45 · 357 阅读 · 0 评论 -
LeetCode 392. Is Subsequence
题目:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) s原创 2017-05-01 23:22:35 · 273 阅读 · 0 评论 -
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 129. Sum Root to Leaf Numbers
题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the t原创 2017-03-26 16:59:28 · 266 阅读 · 0 评论 -
Leetcode 111. Minimum Depth of Binary Tree
题目:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 即求根结点到其叶节点的最短距离。 简单地用BFS就可以解决问原创 2017-03-21 15:02:37 · 291 阅读 · 0 评论 -
LeetCode 343. Integer Break
题目: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n =原创 2017-07-04 17:23:13 · 288 阅读 · 0 评论