leetcode
Zeongwan
这个作者很懒,什么都没留下…
展开
-
Leetcode 216 组合总和III
Leetcode 216 组合总和III题目描述找出所有相加之和为 n 的 k 个数的组合**。**组合中只允许含有 1 - 9 的正整数,并且每种组合中不存在重复的数字。说明所有数字都是正整数。解集不能包含重复的组合。实例1输入: k = 3, n = 7输出: [[1,2,4]]实例2输入: k = 3, n = 9输出: [[1,2,6], [1,3,5], [2...原创 2019-11-19 00:17:28 · 216 阅读 · 0 评论 -
Leetcode 413 & 446
Leetcode 413 & 446Leetcode 413 Arithmetic SlicesDescriptionA sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements原创 2017-11-27 09:47:15 · 463 阅读 · 0 评论 -
Leetcode 486
Leetcode 486DescriptionGiven an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each原创 2017-11-27 09:14:59 · 625 阅读 · 0 评论 -
Leetcode 474 Ones and Zeroes
Leetcode 474 Ones and ZeroesDescriptionIn the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a dominator of m原创 2017-11-19 22:51:48 · 229 阅读 · 0 评论 -
Leetcode 322 & 518
Leetcode 322 & 518322 Leetcode Coin ChangeDescriptionYou 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 n原创 2017-10-29 15:46:13 · 329 阅读 · 0 评论 -
Leetcode 322 & 518
Leetcode 322 & 518Leetcode 322 Coin ChangeDescriptionYou 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 n原创 2017-11-19 23:13:04 · 356 阅读 · 0 评论 -
Leetcode 392 Is Subsequence
Leetcode 392 Is SubsequenceDescriptioniven 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 v原创 2017-12-02 20:12:35 · 228 阅读 · 0 评论 -
Leetcode 712 Minimum ASCII Delete Sum for Two Strings
Leetcode 712 Minimum ASCII Delete Sum for Two StringsDescriptionGiven two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 = "原创 2017-12-08 21:20:39 · 271 阅读 · 0 评论 -
Leetcode 300 Longest Increasing Subsequence
Leetcode 300 Longest Increasing SubsequenceDescriptionGiven an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longes原创 2017-12-08 20:58:08 · 222 阅读 · 0 评论 -
Leetcode 105&106
Leetcode 105 & 106这两道题类似,都是根据树的遍历来重建一棵树。 先复习下先序中序后序:先序根左右,中序左根右,后序左右根,区别是根的出现的顺序。一开始想着用传vector的方法,但是后来发现内存爆了,用索引的方法更好说下105即根据先序中序遍历来重建一棵树的做法:因为先序的第一个元素是根,然后在中序遍历中找到这个根。然后在中序的遍历元素中,根左边的那些元素是根的左子树,右边是右子树原创 2017-09-10 20:45:49 · 372 阅读 · 0 评论 -
Leetcode 547
Leetcode547 FriendCirclesdescriptionThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, a原创 2017-09-18 08:47:21 · 600 阅读 · 0 评论 -
Leetcode 169 & 229
Leetcode 169 & 229169 Majority ElementDescriptionGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the ar原创 2017-09-18 19:57:04 · 1265 阅读 · 0 评论 -
LeetCode 84
Leetcode 84 Largest Rectangle in HistogramDescriptionGiven n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the hi原创 2017-09-25 00:34:44 · 398 阅读 · 0 评论 -
Leetcode 221 & 85
Leetcode 221 & 85Leetcode 221 Maximal SquareDescriptionGiven a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.For example, given the following原创 2017-09-25 17:05:36 · 371 阅读 · 0 评论 -
Leetcode 374 & 375
Leetcode 374 & 375374 Guess Number Higher or LowerDescriptionWe are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time yo原创 2017-09-25 17:07:47 · 422 阅读 · 0 评论 -
Leetcode 658 Find K Closest Elements
Leetcode 658 Find K Closest ElementsDescriptionGiven a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there i原创 2017-09-25 17:08:15 · 438 阅读 · 0 评论 -
Leetcode 263 & 264 & 313
Leetcode 263 & 264 & 313原创 2017-10-24 14:54:09 · 346 阅读 · 0 评论