- 博客(17)
- 收藏
- 关注
原创 123. Best Time to Buy and Sell Stock III
题目描述: Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may no
2018-01-12 20:13:59
175
原创 Leetcode 513. Find Bottom Left Tree Value
题目描述: Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \ 2 3 / / \ 4 5 6
2017-12-31 10:30:03
191
原创 Leetcode 241. Different Ways to Add Parentheses
题目描述: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example
2017-12-23 22:17:41
231
原创 Leetcode 743. Network Delay Time
题目描述: There are N network nodes, labelled 1 to N.Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the target node, and w is the time it t
2017-12-15 20:57:21
510
原创 Leetcode 621. Task Scheduler
题目描述: Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each task c
2017-12-10 10:36:41
203
原创 688. Knight Probability in Chessboard
题目描述: On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the top-left square is (0, 0), and the bottom-r
2017-12-01 13:47:12
269
原创 96. Unique Binary Search Trees
题目描述: Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2 1 \
2017-11-26 18:08:23
139
原创 Leetcode 718. Maximum Length of Repeated Subarray
题目描述: Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1:Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Output: 3Explanation: The repeated subarra
2017-11-17 17:10:56
201
原创 Leetcode Add to List 207. Course Schedule
题目描述: There are a total of n courses you have to take, labeled from 0ton - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a
2017-11-12 23:47:53
206
原创 Leetcode 122. Best Time to Buy and Sell Stock II
题目: Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on
2017-10-28 16:37:57
191
原创 Leetcode 695. Max Area of Island
题目: Given 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 four edges of the grid are su
2017-10-19 22:58:19
228
原创 Leetcode 455. Assign Cookies
题目: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a
2017-10-16 08:33:45
206
原创 Leetcode 133. Clone Graph用BFS、DFS两种解法
题目要求:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization: Nodes are labeled uniquely.We use # as a separator for each nod
2017-09-29 15:27:47
606
原创 DFS的应用——Binary Tree Paths
Description Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are: ["1->2->5", "1->3"]树节点定义: /** * D
2017-09-24 16:51:48
251
原创 二分法求解Leetcode 34. Search for a Range
DescriptionGiven an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If th
2017-09-17 16:45:58
189
原创 Leetcode 56.Merge Intervals
Leetcode题目:Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].分析: 这是Leetcode排序题中的一道,属于m
2017-09-10 18:15:31
231
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人