LeetCode
文章平均质量分 84
Yung_Lin
这个作者很懒,什么都没留下…
展开
-
207. Course Schedule
207. Course Schedule There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, wh原创 2017-09-25 10:48:48 · 274 阅读 · 0 评论 -
62. Unique Paths
62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is tr原创 2018-01-10 19:18:45 · 168 阅读 · 0 评论 -
55. Jump Game
55. Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determi原创 2018-01-03 14:36:42 · 204 阅读 · 0 评论 -
679. 24 Game
679. 24 GameYou have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through *, /, +, -, (, ) to get the value of 24.Example 1: Input: [4, 1, 8, 7] Outp原创 2018-01-03 01:15:11 · 254 阅读 · 0 评论 -
698. Partition to K Equal Sum Subsets
698. Partition to K Equal Sum SubsetsGiven an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty subsets whose sums are all equal.Example原创 2017-12-17 16:33:25 · 211 阅读 · 0 评论 -
23. Merge k Sorted Lists
23. Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题目大意合并k个已经排好序的序列。解题思路一开始没有考虑空间复杂度,将k个序列用分治法的思路进行合并,而合并两个序列依然是使用分治法,所以整个算法的时间复杂度原创 2017-12-25 01:24:26 · 176 阅读 · 0 评论 -
740. Delete and Earn
740. Delete and EarnGiven an array nums of integers, you can perform operations on the array.In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every e原创 2017-12-10 16:24:40 · 206 阅读 · 0 评论 -
718. Maximum Length of Repeated Subarray
718. Maximum Length of Repeated SubarrayGiven 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]原创 2017-11-19 22:02:45 · 166 阅读 · 0 评论 -
240. Search a 2D Matrix II
240. Search a 2D Matrix IIWrite 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 in ascending from left to原创 2017-11-12 23:58:40 · 168 阅读 · 0 评论 -
129. Sum Root to Leaf Numbers
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原创 2017-10-22 23:06:22 · 164 阅读 · 0 评论 -
714. Best Time to Buy and Sell Stock with Transaction Fee
714. Best Time to Buy and Sell Stock with Transaction FeeYour are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee re原创 2017-10-30 11:40:37 · 198 阅读 · 0 评论 -
117. Populating Next Right Pointers in Each Node II
117. Populating Next Right Pointers in Each Node II Follow up for problem “Populating Next Right Pointers in Each Node”. What if the given tree could be any binary tree? Would your previous soluti原创 2017-10-12 14:58:23 · 252 阅读 · 0 评论 -
116. Populating Next Right Pointers in Each Node
116. Populating Next Right Pointers in Each Node Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to原创 2017-10-09 11:41:38 · 182 阅读 · 0 评论 -
215. Kth Largest Element in an Array
215. Kth Largest Element in an Array Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example,原创 2017-09-10 21:49:34 · 244 阅读 · 0 评论 -
210. Course Schedule II
210. Course Schedule II原创 2017-09-25 11:18:10 · 241 阅读 · 0 评论 -
133. Clone Graph
133. Clone Graph 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原创 2017-09-26 15:59:36 · 323 阅读 · 0 评论 -
241. Different Ways to Add Parentheses
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 op原创 2017-09-17 13:47:42 · 255 阅读 · 0 评论 -
63. Unique Paths II
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 0 respectively原创 2018-01-10 19:47:55 · 188 阅读 · 0 评论