- 博客(7)
- 资源 (4)
- 收藏
- 关注
原创 LeetCode 316. Remove Duplicate Letters
题目Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order
2017-02-07 19:26:19 296
原创 LeetCode 282. Expression Add Operators
题目Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value.Exampl
2017-02-07 18:42:24 320
原创 LeetCode 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.You ma
2017-02-05 12:45:44 271
原创 LeetCode 99. Recover Binary Search Tree
题目Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note: A solution using O(n) space is pretty straight forward. Could you devise a con
2017-02-05 11:52:14 397
原创 LeetCode 327. Count of Range Sum
题目Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) is defined as the sum of the elements in nums between indices i and j (i ≤ j), in
2017-02-05 11:20:46 481
原创 LeetCode 25. Reverse Nodes in k-Group
给一个链表,每k个反转一下,最后不够的不反转。 写了半天,实在是太弱了。 struct XNode{ ListNode *t1, *t2; int flag; };class Solution {public: XNode dfs( ListNode* pre, ListNode* nows, int cnt, int k ){ //if( nows =
2017-02-04 14:32:04 289
原创 Leetcode 330. Patching Array
解法真的厉害!学习了!这道题给我们一个有序的正数数组nums,又给了我们一个正整数n,问我们最少需要给nums加几个数字,使其能组成[1,n]之间的所有数字,注意数组中的元素不能重复使用。我们定义一个变量miss,用来表示[0,n]之间最小的不能表示的值,那么初始化为1。那么此时我们能表示的范围是[0, miss),表示此时我们能表示0到miss-1的数,如果此时的num <= miss,那么我们可
2017-02-03 21:53:16 536
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人