自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

刷题笔记

以颤抖之身追赶,怀敬畏之心挑战

  • 博客(34)
  • 收藏
  • 关注

原创 [Leetcode] 97, 168, 87

97. Interleaving StringGiven s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.

2017-09-22 09:17:33 251

原创 [Leetcode] 85, 64, 123

85. Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.For example, given the following matrix:1 0 1 0 0

2017-09-21 13:00:49 244

原创 [Leetcode] 11, 120, 132

11. Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of lin

2017-09-20 02:25:57 293

原创 [Leetcode] 121, 122, 3

121. Best Time to Buy and Sell StockSay you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i

2017-09-02 07:53:18 311

原创 [Leetcode] 50, 55, 45

50. Pow(x, n)Implement pow(x, n).Solution:分治法,注意n有可能是负数的情况。Code:class Solution {public: double myPow(double x, int n) { if(n==0) return 1; if(n==1) return x;

2017-09-01 15:21:12 215

原创 [Leetcode] 22, 37, 79

22. Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "((

2017-08-31 12:22:12 163

原创 [Leetcode] 93, 39, 40

93. Restore IP AddressesGiven a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.13

2017-08-30 12:20:40 191

原创 [Leetcode] 63, 51, 52

63. Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and

2017-08-29 21:02:35 257

原创 [Leetcode] 130, 131, 62

130. Surrounded RegionsGiven a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded

2017-08-28 14:39:15 155

原创 [Leetcode] 17, 127, 126

17. Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telepho

2017-08-27 10:25:08 232

原创 [Leetcode] 46, 47, 77

46. PermutationsGiven a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1],

2017-08-26 10:34:15 195

原创 [Leetcode] 74, 78, 90

74. Search a 2D MatrixWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to rig

2017-08-25 09:30:54 185

原创 [Leetcode] 41, 75, 34

41. First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should ru

2017-08-23 20:59:54 309

原创 [Leetcode] 116, 129, 23

116. Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate e

2017-08-22 11:48:27 192

原创 [Leetcode] 113, 53, 124

113. Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5

2017-08-21 22:00:36 235

原创 [Leetcode] 95, 109, 111

95. Unique Binary Search Trees IIGiven an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return

2017-08-20 13:06:34 174

原创 [Leetcode] 105, 106, 96

105. Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in

2017-08-19 19:33:03 216

原创 [Leetcode] 99, 114, 117

99. Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pret

2017-08-19 10:25:02 264

原创 [Leetcode] 103, 94, 98

103. Binary Tree Zigzag Level Order TraversalGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and

2017-08-18 08:15:50 210

原创 [Leetcode] 102, 107, 101

102. Binary Tree Level Order TraversalGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,

2017-08-17 21:41:01 362

原创 [Leetcode] 71, 32, 84

71. Simplify PathGiven an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consid

2017-08-16 15:42:03 175

原创 [Leetcode] 65, 12, 49

65. Valid NumberValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem s

2017-08-15 15:09:24 133

原创 [Leetcode] 13, 38, 58

13. Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Solution: 罗马数字转十进制数的规则如下:摘自:http://www.cnblogs.com/rustf

2017-08-14 09:29:26 160

原创 [Leetcode] 10, 44, 69

10. Regular Expression MatchingImplement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The

2017-08-13 22:30:03 362

原创 [Leetcode] 28, 8, 5

28. Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Solution(1): 直接暴力求解,时间复杂度O(m*n),面试时这样做就可

2017-08-12 18:37:47 145

原创 [Leetcode] 24, 25, 138

24. Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm shou

2017-08-11 17:48:35 153

原创 [Leetcode] 82, 61, 19

82. Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1-

2017-08-10 18:34:11 248

原创 [Leetcode] 2, 92, 86

2. Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the

2017-08-09 20:45:59 121

原创 [Leetcode] 135, 136, 137

135. CandyThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must ha

2017-08-08 20:22:18 174

原创 [Leetcode] 73, 134, 53

73. Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Solution(1): 这道题要求找到0的元素,然后将它所在的行和列置0。这题的关键点是要求in-place操作,因此在进行置0之前必须将所有

2017-08-07 14:19:51 142

原创 [Leetcode] 42, 48, 89

42. Trapping Rain WaterGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Gi

2017-08-06 16:21:46 209

原创 [Leetcode] 31, 60, 36

31. Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearr

2017-08-05 17:05:42 239

原创 [Leetcode] 128, 16, 18

128. Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest co

2017-08-04 15:24:43 195

原创 [Leetcode] 15, 81, 4

15. 3SumGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set mu

2017-08-03 23:47:34 239

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除