![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hard
文章平均质量分 75
chuandalishuo
这个作者很懒,什么都没留下…
展开
-
174. Dungeon Game
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p原创 2016-10-09 12:38:05 · 162 阅读 · 0 评论 -
10. Regular Expression Matching
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 entire input st原创 2016-12-05 07:58:50 · 280 阅读 · 0 评论 -
301. Remove Invalid Parentheses
题目: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 parentheses原创 2016-12-05 04:46:37 · 180 阅读 · 0 评论 -
31. Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible原创 2016-11-02 16:19:50 · 198 阅读 · 0 评论 -
394. Decode String
Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is原创 2016-11-17 02:28:29 · 167 阅读 · 0 评论 -
164. Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 elements原创 2016-11-13 05:00:17 · 213 阅读 · 0 评论 -
287. Find the Duplicate Number
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 duplicate number,原创 2016-11-01 01:18:37 · 145 阅读 · 0 评论 -
204. Count Primes
Description:Count the number of prime numbers less than a non-negative number, n.思路: 从前向后扫描,第一次遇到没标记的应该是没有因子的质数。然后把后面所有这个质数的倍数都标记了。 public int countPrimes(int n) { if(n<2) retur原创 2016-10-21 08:54:44 · 141 阅读 · 0 评论 -
201. Bitwise AND of Numbers Range
Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4.思路:从左到右比较m和n的二进制数,相同的base加起来,直到出现不同的base,停止比较,因为后面一定是0,1交错的,而前面的一定是相同的(比较过来的),只要返回这些相同部分。public class原创 2016-10-20 06:59:38 · 156 阅读 · 0 评论 -
121.122.123.188. Best Time to Buy and Sell Stock I II III IV
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2016-10-18 08:23:58 · 273 阅读 · 0 评论 -
373. Find K Pairs with Smallest Sums
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k.Define a pair (u,v) which consists of one element from the first array and one element from the second a原创 2016-11-08 09:00:24 · 158 阅读 · 0 评论 -
190. Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010原创 2016-10-18 02:28:22 · 240 阅读 · 0 评论 -
223. Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the tota原创 2016-10-27 07:48:56 · 167 阅读 · 0 评论 -
374,375. Guess Number Higher or Lower I,II
We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number I pi原创 2016-11-03 14:22:42 · 258 阅读 · 0 评论 -
179. Largest Number
Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve原创 2016-10-12 06:21:30 · 156 阅读 · 0 评论 -
209. Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given the array [2,3原创 2016-10-22 02:25:28 · 157 阅读 · 0 评论