摘要:
``` class Solution { public: ListNode *partition(ListNode *head, int x) { ListNode *dummy = new ListNode(-1); dummy->next = head; ListNode *pre = dummy, *cur = head;; ... 阅读全文
posted @ 2019-04-09 12:02
JohnRed
阅读(63)
评论(0)
推荐(0)
摘要:
class Solution { public: / @param matrix a boolean 2D matrix @return an integer / int maximalRectangle(vector &matrix) { if (matrix.empty() || matrix[ 阅读全文
posted @ 2019-04-09 11:59
JohnRed
阅读(105)
评论(0)
推荐(0)
摘要:
class Solution { public: int largestRectangleArea(vector &height) { int res = 0; stack st; height.push_back(0); for (int i = 0; i 阅读全文
posted @ 2019-04-09 11:51
JohnRed
阅读(79)
评论(0)
推荐(0)
摘要:
```
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public: ListNode... 阅读全文
posted @ 2019-04-09 11:46
JohnRed
阅读(66)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: ListNode *deleteDuplicates(ListNode *head) { if (!head || !head->next) return head; ListNode *dummy = new ListNode(-1), *pre = dummy; dummy->ne... 阅读全文
posted @ 2019-04-09 11:45
JohnRed
阅读(74)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool search(int A[], int n, int target) { if (n == 0) return false; int left = 0, right = n - 1; while (left = target) left = mid + 1; ... 阅读全文
posted @ 2019-04-09 11:44
JohnRed
阅读(86)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int removeDuplicates(int A[], int n) { if (n 阅读全文
posted @ 2019-04-09 11:17
JohnRed
阅读(79)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool exist(vector>& board, string word) { if (board.empty() || board[0].empty()) return false; int m = board.size(), n = board[0].size(); vecto... 阅读全文
posted @ 2019-04-09 11:15
JohnRed
阅读(128)
评论(0)
推荐(0)
摘要:
``` // Non recursion class Solution { public: vector subsets(vector &S) { vector res(1); sort(S.begin(), S.end()); for (int i = 0; i subsets(vector &S 阅读全文
posted @ 2019-04-09 11:13
JohnRed
阅读(97)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector combine(int n, int k) { vector res; vector out; helper(n, k, 1, out, res); return res; } void helper(int n, int k, 阅读全文
posted @ 2019-04-09 11:12
JohnRed
阅读(92)
评论(0)
推荐(0)

浙公网安备 33010602011771号