![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode hard
文章平均质量分 83
brenda_zhao
这个作者很懒,什么都没留下…
展开
-
Hard 146题 LRU Cache
Question:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive)原创 2016-10-17 12:20:57 · 180 阅读 · 0 评论 -
Hard 76题 Minimum Window Substring
Question:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum原创 2016-10-12 00:17:11 · 227 阅读 · 0 评论 -
Hard 10题 Regular Expression Matching
Question:Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the原创 2016-10-11 22:53:31 · 221 阅读 · 0 评论 -
Hard 301题 Remove Invalid Parentheses
Question:Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results.Note: The input string may contain letters other than the paren原创 2016-10-11 09:26:03 · 172 阅读 · 0 评论 -
Hard 211题 Add and Search Word - Data structure design
Question:Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regular expression string conta原创 2016-10-09 01:56:11 · 259 阅读 · 0 评论 -
Hard 23题 Merge k Sorted Lists
Question:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Solution:priority queue/** * Definition for singly-linked list. * public class原创 2016-10-07 13:12:46 · 248 阅读 · 0 评论 -
Hard 56题 Merge Intervals
QUESTION:Given 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].SOLUTION:和insert Intervals很类似,只是解原创 2016-09-30 14:35:06 · 136 阅读 · 0 评论 -
Hard 287题 Find the Duplicate Number
Question:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one dupli原创 2016-09-29 12:49:02 · 210 阅读 · 0 评论 -
Hard 57题 Insert Interval
Question:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their st原创 2016-09-29 02:35:34 · 220 阅读 · 0 评论 -
Hard 380题 Insert Delete GetRandom O(1)
Question:Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to the set if not already present.remove(val): Removes an it原创 2016-09-25 05:17:41 · 257 阅读 · 0 评论 -
Hard 154题 Find Minimum in Rotated Sorted Array II
Question:Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a sorted array is rotated原创 2016-09-24 11:04:21 · 160 阅读 · 0 评论 -
Hard 297题 Serialize and Deserialize Binary Tree
Question:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connec原创 2016-10-27 02:43:40 · 194 阅读 · 0 评论 -
Hard 65题 Valid Number
Question:Validate 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 statemen原创 2016-10-27 11:21:35 · 274 阅读 · 0 评论 -
Hard 68题 Text Justification
Question:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy a原创 2016-10-24 01:37:36 · 147 阅读 · 0 评论