- 博客(13)
- 资源 (1)
- 收藏
- 关注
原创 [leetcode] 406. Queue Reconstruction by Height 解题报告
题目链接:https://leetcode.com/problems/queue-reconstruction-by-height/Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers(h, k), where h is
2016-09-29 09:57:33 5879 1
原创 [leetcode] 407. Trapping Rain Water II 解题报告
题目链接:https://leetcode.com/problems/trapping-rain-water-ii/Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of wate
2016-09-29 06:25:11 5825 3
原创 数组中两个元素异或求最大值
给一个整数数组,求数组中两个元素异或的最大值.思路:naive的做法是两两异或求最大值,时间复杂度为O(n*n),但是还有一种O(n)的解法,利用字典树Trie来实现.其思路是利用数组中的每个元素二进制表示形式建一棵树,我看到网上大多数解法都开了太大的数组空间,不知道为什么,但是我觉得没有必要.只要用现有的数组元素二进制值建一棵深度为33的树即可,从根到叶子结点的路径就代表了一个元
2016-09-28 22:56:57 7056 1
原创 [leetcode] 397. Integer Replacement 解题报告
题目链接:https://leetcode.com/problems/integer-replacement/Given a positive integer n and you can do operations as follow:If n is even, replace n with n/2.If n is odd, you can replace n with
2016-09-19 13:25:56 1060
原创 [leetcode] 398. Random Pick Index 解题报告
题目链接:https://leetcode.com/problems/random-pick-index/Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target
2016-09-19 13:17:13 1876
原创 [leetcode] 402. Remove K Digits 解题报告
题目链接:https://leetcode.com/problems/remove-k-digits/Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.N
2016-09-19 11:50:18 6388
原创 [leetcode] 401. Binary Watch 解题报告
题目链接:https://leetcode.com/problems/binary-watch/A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED repr
2016-09-19 09:45:37 3635
原创 [leetcode] 400. Nth Digit 解题报告
题目链接:https://leetcode.com/problems/nth-digit/Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...Note:n is positive and will fit within the range of a
2016-09-19 08:54:28 5429
原创 [leetcode] 399. Evaluate Division 解题报告
题目链接:https://leetcode.com/problems/evaluate-division/Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point num
2016-09-17 05:05:21 3469
原创 [leetcode] 392. Is Subsequence 解题报告
题目链接:https://leetcode.com/problems/is-subsequence/Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t
2016-09-09 14:49:15 2411
原创 [leetcode] 393. UTF-8 Validation 解题报告
题目链接:https://leetcode.com/problems/utf-8-validation/A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:For 1-byte character, the first bit is a 0, followed b
2016-09-09 08:54:54 2486
原创 [leetcode] 391. Perfect Rectangle 解题报告
题目链接:https://leetcode.com/problems/perfect-rectangle/Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover of a rectangular region.Each rectangle is
2016-09-09 05:33:29 2439
原创 [leetcode] 394. Decode String 解题报告
题目链接: https://leetcode.com/problems/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 br
2016-09-05 12:19:56 4602
qt3扫雷代码
2013-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人