上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 20 下一页
摘要: class Solution { public: int longestValidParentheses(string s) { int res = 0, start = 0; stack<int> m; for (int i = 0; i < s.size(); ++i) { if (s[i] = 阅读全文
posted @ 2017-02-13 23:36 王坤1993 阅读(124) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: void nextPermutation(vector<int> &num) { int i, j, n = num.size(); for (i = n - 2; i >= 0; --i) { if (num[i + 1] > num[i]) { 阅读全文
posted @ 2017-02-13 00:00 王坤1993 阅读(136) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<int> findSubstring(string s, vector<string>& words) { if (s.empty() || words.empty()) return {}; vector<int> res; int 阅读全文
posted @ 2017-02-12 00:02 王坤1993 阅读(197) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int divide(int dividend, int divisor) { long long res = 0; long long m = abs((long long)dividend), n = abs((long long)divisor 阅读全文
posted @ 2017-02-12 00:01 王坤1993 阅读(146) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int strStr(string haystack, string needle) { if (needle.empty()) return 0; int m = haystack.size(), n = needle.size(); if (m 阅读全文
posted @ 2017-02-12 00:00 王坤1993 阅读(200) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int removeElement(vector<int>& nums, int val) { int res = 0; for (int i = 0; i < nums.size(); ++i) { if (nums[i] != val) nums 阅读全文
posted @ 2017-02-11 23:59 王坤1993 阅读(125) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int removeDuplicates(int A[], int n) { if (n <= 1) return n; int pre = 0, cur = 0; while (cur < n) { if (A[cur] == A[pre]) ++ 阅读全文
posted @ 2017-02-11 23:57 王坤1993 阅读(91) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: ListNode* reverseKGroup(ListNode* head, int k) { ListNode *cur = head; for (int i = 0; i < k; ++i) { if (!cur) return head; c 阅读全文
posted @ 2017-02-10 22:42 王坤1993 阅读(104) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: ListNode* swapPairs(ListNode* head) { if (!head || !head->next) return head; ListNode *t = head->next; head->next = swapPairs 阅读全文
posted @ 2017-02-10 22:38 王坤1993 阅读(129) 评论(0) 推荐(0) 编辑
摘要: struct cmp { bool operator () (ListNode *a, ListNode *b) { return a->val > b->val; } }; class Solution { public: ListNode *mergeKLists(vector<ListNode 阅读全文
posted @ 2017-02-10 22:35 王坤1993 阅读(128) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 20 下一页