- 博客(20)
- 收藏
- 关注
原创 LeetCode-Longest Valid Parentheses
算法分析与设计,第19周博客32. Longest Valid ParenthesesGiven a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()"
2018-01-13 21:09:48
245
原创 LeetCode-Longest Consecutive Sequence
算法分析与设计,第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
2018-01-07 21:47:02
314
原创 LeetCode-Binary Tree Maximum Path Sum
算法分析与设计,第17周博客124. Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to an
2018-01-01 16:24:49
255
原创 吝啬SAT问题是NP完全问题的证明
算法概论,第八章课后习题8.3吝啬SAT问题是这样的:给定一组子句(每个子句都是其中文字的析取)和整数k,求一个最多有k个变量为true的满足赋值——如果该赋值存在。证明吝啬SAT问题为NP完全问题。首先,证明吝啬SAT问题是NP问题:对于吝啬SAT问题的一个可能解,只需要把解中的每个变量的值带入原子句中,化简后判断其是否为true;另外还需要额外的判断这个解中变量为true的个数是否
2017-12-31 17:47:45
1218
原创 LeetCode-Decode Ways II
算法分析与设计,第16周博客639. Decode Ways IIA message containing letters from A-Z is being encoded to numbers using the following mapping way:'A' -> 1'B' -> 2...'Z' -> 26Beyond that, now th
2017-12-24 15:55:30
523
原创 LeetCode-Largest Rectangle in Histogram
算法分析与设计,第15周博客 84. Largest Rectangle in HistogramGiven n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle
2017-12-17 16:10:55
242
原创 LeetCode- First Missing Positive
算法分析与设计,第14周博客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 a
2017-12-10 14:40:18
204
原创 LeetCode-Edit Distance
算法分析与设计,第13周博客72. Edit DistanceGiven two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the fo
2017-12-01 14:28:30
210
原创 LeetCode-Course Schedule II
算法分析与设计,第12周博客210. Course Schedule IIThere 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
2017-11-23 21:11:41
293
原创 LeetCode-Permutation Sequence
算法分析与设计,第十一周博客。60. Permutation SequenceThe set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following se
2017-11-16 16:17:47
397
原创 LeetCode-Insert Interval
算法分析与设计,第10周博客57. Insert IntervalGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially
2017-11-10 16:10:44
268
原创 LeetCode-Kth Largest Element in an Array
算法分析与设计,第九周博客215. Kth Largest Element in an ArrayDescriptionFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted o
2017-11-05 14:39:24
338
原创 LeetCode-Search in Rotated Sorted Array
算法分析与设计,第八周博客33. Search in Rotated Sorted ArraySuppose 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 become 4 5 6 7 0
2017-10-29 15:43:47
232
原创 LeetCode-Merge k Sorted Lists
算法分析与设计,第7周博客23. Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题意是,给出k个已排好序的链表,把它们合并成一个链表。看完题目以后,可能不是很清楚,但是看到给出的函数接口
2017-10-20 23:09:32
245
原创 LeetCode-3Sum
算法分析与设计第6周博客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
2017-10-15 21:45:18
196
原创 LeetCode-Trapping Rain Water
算法分析与设计,第四周博客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.
2017-09-30 18:02:33
270
原创 LeetCode-Regular Expression Matching
算法分析与设计,第三周博客。Regular Expression MatchingImplement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding elem
2017-09-22 15:42:39
286
原创 LeetCode- Longest Palindromic Subsequence
算法分析与设计,第二周博客 Longest Palindromic SubsequenceGiven a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.Example 1:Inp
2017-09-13 20:31:58
249
原创 LeetCode-Longest Palindromic Substring
算法分析与设计,第二周博客Longest Palindromic SubstringDescription:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:I
2017-09-13 15:13:31
292
原创 LeetCode-Median of Two Sorted Arrays
算法分析与设计,第一周博客Median of Two Sorted ArraysDescription:There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run tim
2017-09-10 19:14:08
307
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人