- 博客(151)
- 收藏
- 关注
原创 208. Implement Trie (Prefix Tree)
208. Implement Trie (Prefix Tree)MediumImplement a trie with insert, search, and startsWith methods.Example:Trie trie = new Trie();trie.insert("apple");trie.search("apple"); // returns t...
2019-01-26 22:17:36
248
原创 201. Bitwise AND of Numbers Range
201. Bitwise AND of Numbers RangeMediumGiven a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.Example 1:Input: [5,7]Out...
2019-01-24 18:45:47
253
原创 200. Number of Islands
200. Number of IslandsMediumGiven a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontal...
2019-01-24 16:33:07
219
原创 596. Classes More Than 5 Students
596. Classes More Than 5 StudentsEasy132344FavoriteShareSQL SchemaThere is a table courses with columns: student and classPlease list out all classes which have more than or equal to 5 stude...
2019-01-24 10:46:29
153
原创 626. Exchange Seats
626. Exchange SeatsMedium135126FavoriteShareSQL SchemaMary is a teacher in a middle school and she has a table seat storing students' names and their corresponding seat ids.The column id is ...
2019-01-24 10:44:56
442
原创 262. Trips and Users
262. Trips and UsersHard158116FavoriteShareSQL SchemaThe Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the...
2019-01-24 10:43:10
181
原创 142. Linked List Cycle II
142. Linked List Cycle IIMediumGiven a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linked list, we use an integer pos...
2019-01-22 11:33:20
135
原创 173. Binary Search Tree Iterator
173. Binary Search Tree IteratorMediumImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next sma...
2019-01-22 11:16:15
138
原创 892. Surface Area of 3D Shapes
892. Surface Area of 3D ShapesEasyOn a N * N grid, we place some 1 * 1 * 1 cubes.Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j).Return the total surf...
2019-01-17 15:18:02
112
原创 162. Find Peak Element
162. Find Peak ElementMedium6561047FavoriteShareA peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and re...
2019-01-17 10:45:59
99
原创 165. Compare Version Numbers
165. Compare Version NumbersMedium223973FavoriteShareCompare two version numbers version1 and version2.If version1 > version2 return 1; if version1 <version2 return -1;otherwise return 0....
2019-01-17 00:00:21
118
原创 187. Repeated DNA Sequences
187. Repeated DNA SequencesMedium358142FavoriteShareAll DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes us...
2019-01-16 22:53:21
130
原创 209. Minimum Size Subarray Sum
209. Minimum Size Subarray SumMedium87660FavoriteShareGiven an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If th...
2019-01-16 17:40:21
94
原创 153. Find Minimum in Rotated Sorted Array
153. Find Minimum in Rotated Sorted ArrayMedium751133FavoriteShareSuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might be...
2019-01-16 14:32:27
105
原创 150. Evaluate Reverse Polish Notation
150. Evaluate Reverse Polish NotationMedium414303FavoriteShareEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an i...
2019-01-16 14:01:56
108
原创 260. Single Number III
260. Single Number IIIMedium69566FavoriteShareGiven an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two element...
2019-01-16 12:56:58
124
原创 147. Insertion Sort List
147. Insertion Sort ListMedium274332FavoriteShareSort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only the fir...
2019-01-16 11:06:54
170
原创 143. Reorder List
143. Reorder ListMedium66755FavoriteShareGiven a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itse...
2019-01-15 23:34:03
215
原创 137. Single Number II
137. Single Number IIMedium655224FavoriteShareGiven a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Note:You...
2019-01-15 20:43:07
290
原创 138. Copy List with Random Pointer
138. Copy List with Random PointerMediumA linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of t...
2018-12-22 20:46:33
91
原创 179. Largest Number
179. Largest NumberMediumGiven a list of non negative integers, arrange them such that they form the largest number.Example 1:Input: [10,2]Output: "210"Example 2:Input: [3,30,34,5,9]Ou...
2018-12-22 15:31:57
93
原创 131. Palindrome Partitioning
131. Palindrome PartitioningMediumGiven a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.Example:Input: "a...
2018-12-22 13:09:36
99
原创 130. Surrounded Regions
130. Surrounded RegionsMediumGiven 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 ...
2018-12-20 16:41:59
164
原创 959. Regions Cut By Slashes
959. Regions Cut By SlashesMediumIn a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space. These characters divide the square into contiguous regions.(Not...
2018-12-20 16:04:07
217
原创 114. Flatten Binary Tree to Linked List
114. Flatten Binary Tree to Linked ListMediumGiven a binary tree, flatten it to a linked list in-place.For example, given the following tree: 1 / \ 2 5 / \ \3 4 6The flat...
2018-12-20 13:21:51
106
原创 113. Path Sum II
113. Path Sum IIMediumGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Note: A leaf is a node with no children.Example:Given the below bi...
2018-12-19 23:34:47
130
原创 95. Unique Binary Search Trees II
95. Unique Binary Search Trees IIMediumGiven an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n.Example:Input: 3Output:[ [1,null,3,2], ...
2018-12-19 22:18:14
102
原创 133. Clone Graph
133. Clone GraphMediumGiven the head of a graph, return a deep copy (clone) of the graph. Each node in the graph contains a label (int) and a list (List[UndirectedGraphNode]) of its neighbors. The...
2018-12-18 18:00:32
92
原创 106. Construct Binary Tree from Inorder and Postorder Traversal
106. Construct Binary Tree from Inorder and Postorder TraversalMediumGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist ...
2018-12-16 18:08:27
100
原创 105. Construct Binary Tree from Preorder and Inorder Traversal
105. Construct Binary Tree from Preorder and Inorder TraversalMediumGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in...
2018-12-16 17:43:53
133
原创 96. Unique Binary Search Trees
96. Unique Binary Search TreesMediumGiven n, how many structurally unique BST's (binary search trees) that store values 1 ... n?Example:Input: 3Output: 5Explanation:Given n = 3, there are ...
2018-12-16 14:50:39
79
原创 56. Merge Intervals
56. Merge IntervalsMediumGiven a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since inter...
2018-12-15 21:39:56
107
原创 81. Search in Rotated Sorted Array II
81. Search in Rotated Sorted Array IIMediumSuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]).Yo...
2018-12-15 19:57:36
105
原创 931. Minimum Falling Path Sum
931. Minimum Falling Path SumMediumGiven a square array of integers A, we want the minimum sum of a falling path through A.A falling path starts at any element in the first row, and chooses one ...
2018-11-11 16:31:40
200
原创 938. Range Sum of BST
938. Range Sum of BSTMediumGiven the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).The binary search tree is guaranteed to have ...
2018-11-11 16:06:43
251
原创 701. Insert into a Binary Search Tree
701. Insert into a Binary Search TreeMediumGiven the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BS...
2018-11-11 15:48:41
163
原创 695. Max Area of Island
695. Max Area of IslandMediumGiven a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all ...
2018-11-11 15:21:36
212
转载 浏览器内部工作原理
https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/ http://kb.cnblogs.com/page/129756/
2017-05-13 19:23:08
218
原创 344. Reverse String
Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Subscribe to see which companies asked this question.Java Code:p
2017-05-02 22:50:57
176
原创 94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Recursive solution is tr
2017-04-29 23:02:04
152
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人