摘要:
``` class Solution { public: int sumNumbers(TreeNode* root) { return sumNumbersDFS(root, 0); } int sumNumbersDFS(TreeNode* root, int sum) { if (!root) return 0; sum... 阅读全文
posted @ 2019-04-09 16:15
JohnRed
阅读(67)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int longestConsecutive(vector& nums) { int res = 0; unordered_set s(nums.begin(), nums.end()); for (int val : nums) { if (!s.count(... 阅读全文
posted @ 2019-04-09 16:05
JohnRed
阅读(86)
评论(0)
推荐(0)
摘要:
``` class Solution { public: typedef unordered_set::iterator HashIter; vector findLadders(string start, string end, unordered_set &dict) { // Note: Th 阅读全文
posted @ 2019-04-09 15:35
JohnRed
阅读(79)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int ladderLength(string start, string end, unordered_set &dict) { // IMPORTANT: Please reset any member data you declared 阅读全文
posted @ 2019-04-09 15:35
JohnRed
阅读(173)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isPalindrome(string s) { int left = 0, right = s.size() 1 ; while (left = 'a' && ch = 'A' && ch = '0' && ch 阅读全文
posted @ 2019-04-09 15:32
JohnRed
阅读(109)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: int maxPathSum(TreeNode* root) { int res = INT_MIN; helper(root, res); return res; } int helper(TreeNode* node, int& res) { if ... 阅读全文
posted @ 2019-04-09 15:30
JohnRed
阅读(89)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int maxProfit(vector &prices) { if (prices.empty()) return 0; int n = prices.size(), g[n][3] = {0}, l[n][3] = {0}; for (i 阅读全文
posted @ 2019-04-09 15:28
JohnRed
阅读(66)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int maxProfit(vector& prices) { int res = 0, n = prices.size(); for (int i = 0; i 阅读全文
posted @ 2019-04-09 15:26
JohnRed
阅读(95)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int maxProfit(vector& prices) { int n = prices.size(); if (n==0){ return 0; } int res = 0; int mmin = prices[0]; for (int 阅读全文
posted @ 2019-04-09 15:25
JohnRed
阅读(77)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int minimumTotal(vector & triangle) { vector dp(triangle.back()); for (int i = (int)triangle.size() 2; i = 0; i) { for (i 阅读全文
posted @ 2019-04-09 15:24
JohnRed
阅读(81)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector getRow(int rowIndex) { vector res(rowIndex + 1); res[0] = 1; for (int i = 1; i = 1; --j) { res[j] += res[j - 1]; ... 阅读全文
posted @ 2019-04-09 15:22
JohnRed
阅读(53)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector generate(int numRows) { vector res(numRows, vector()); for (int i = 0; i 阅读全文
posted @ 2019-04-09 15:21
JohnRed
阅读(88)
评论(0)
推荐(0)
摘要:
``` class Solution { public: Node* connect(Node* root) { if (!root) return NULL; Node *p = root->next; while (p) { if (p->left) { p = p->left; ... 阅读全文
posted @ 2019-04-09 15:20
JohnRed
阅读(87)
评论(0)
推荐(0)
摘要:
``` class Solution { public: Node* connect(Node* root) { if (!root) return NULL; if (root->left) root->left->next = root->right; if (root->right) root->right->next = root->... 阅读全文
posted @ 2019-04-09 15:18
JohnRed
阅读(72)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int numDistinct(string S, string T) { int dp[T.size() + 1][S.size() + 1]; for (int i = 0; i 阅读全文
posted @ 2019-04-09 15:15
JohnRed
阅读(93)
评论(0)
推荐(0)
摘要:
``` // Recursion class Solution { public: void flatten(TreeNode *root) { if (!root) return; if (root->left) flatten(root->left); if (root->right) flatten(root->right); ... 阅读全文
posted @ 2019-04-09 15:14
JohnRed
阅读(75)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector > pathSum(TreeNode *root, int sum) { vector> res; vector out; helper(root, sum, out, res); return res; } void helper(Tre... 阅读全文
posted @ 2019-04-09 15:11
JohnRed
阅读(78)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool hasPathSum(TreeNode* root, int sum) { if (!root) return false; if (!root->left && !root->right && root->val == sum ) return true; return h... 阅读全文
posted @ 2019-04-09 15:10
JohnRed
阅读(86)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int minDepth(TreeNode* root) { if (!root) return 0; if (!root->left) return 1 + minDepth(root->right); if (!root->right) return 1 + minDepth(ro... 阅读全文
posted @ 2019-04-09 15:04
JohnRed
阅读(74)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: bool isBalanced(TreeNode *root) { if (checkDepth(root) == -1) return false; else return true; } int checkDepth(TreeNode *root) { if... 阅读全文
posted @ 2019-04-09 15:03
JohnRed
阅读(107)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: TreeNode *sortedListToBST(ListNode* head) { if (!head) return NULL; if (!head->next) return new TreeNode(head->val); ListNode *slow = head, *fa... 阅读全文
posted @ 2019-04-09 14:57
JohnRed
阅读(69)
评论(0)
推荐(0)
摘要:
``` class Solution { public: TreeNode* sortedArrayToBST(vector& nums) { return helper(nums, 0 , (int)nums.size() - 1); } TreeNode* helper(vector& nums, int left, int right) { ... 阅读全文
posted @ 2019-04-09 14:55
JohnRed
阅读(65)
评论(0)
推荐(0)
摘要:
``` /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class So... 阅读全文
posted @ 2019-04-09 14:46
JohnRed
阅读(70)
评论(0)
推荐(0)
摘要:
``` /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class So... 阅读全文
posted @ 2019-04-09 14:44
JohnRed
阅读(89)
评论(0)
推荐(0)
摘要:
``` /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class So... 阅读全文
posted @ 2019-04-09 14:43
JohnRed
阅读(80)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int maxDepth(TreeNode* root) { if (!root) return 0; return 1 + max(maxDepth(root->left), maxDepth(root->right)); } }; ``` ``` class Solution { pub... 阅读全文
posted @ 2019-04-09 14:40
JohnRed
阅读(84)
评论(0)
推荐(0)
摘要:
``` /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class So... 阅读全文
posted @ 2019-04-09 14:39
JohnRed
阅读(68)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector> levelOrder(TreeNode* root) { if (!root) return {}; vector> res; queue q{{root}}; while (!q.empty()) { vector oneLev... 阅读全文
posted @ 2019-04-09 14:37
JohnRed
阅读(68)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isSymmetric(TreeNode *root) { if (!root) return true; return isSymmetric(root->left, root->right); } bool isSymmetric(TreeNode *left, Tree... 阅读全文
posted @ 2019-04-09 14:36
JohnRed
阅读(72)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isSameTree(TreeNode *p, TreeNode *q) { if (!p && !q) return true; if ((p && !q) || (!p && q) || (p->val != q->val)) return false; return i... 阅读全文
posted @ 2019-04-09 14:32
JohnRed
阅读(79)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: void recoverTree(TreeNode *root) { TreeNode *cur=root,*pre=nullptr; TreeNode *first=nullptr,*second=nullptr,*parent=nullptr; while(cur) ... 阅读全文
posted @ 2019-04-09 14:30
JohnRed
阅读(76)
评论(0)
推荐(0)
摘要:
``` // Recursion without inorder traversal class Solution { public: bool isValidBST(TreeNode* root) { return isValidBST(root, LONG_MIN, LONG_MAX); } bool isValidBST(TreeNode* root,... 阅读全文
posted @ 2019-04-09 14:25
JohnRed
阅读(76)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isInterleave(string s1, string s2, string s3) { int m = s1.size(); int n = s2.size(); if(m+n != s3.size()) return fa 阅读全文
posted @ 2019-04-09 14:20
JohnRed
阅读(88)
评论(0)
推荐(0)
摘要:
```class Solution { public: int numTrees(int n) { vector dp(n + 1, 0); dp[0] = 1; dp[1] = 1; for (int i = 2; i 阅读全文
posted @ 2019-04-09 14:17
JohnRed
阅读(67)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector generateTrees(int n) { if (n == 0) return {}; return *generateTreesDFS(1, n); } vector *generateTreesDFS(int start, int end) { v... 阅读全文
posted @ 2019-04-09 14:16
JohnRed
阅读(69)
评论(0)
推荐(0)
摘要:
``` // Recursion class Solution { public: vector inorderTraversal(TreeNode *root) { vector res; inorder(root, res); return res; } void inorder(TreeNode *root, vecto... 阅读全文
posted @ 2019-04-09 14:13
JohnRed
阅读(72)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int numDecodings(string s) { if (s.empty() || (s.size() 1 && s[0] == '0')) return 0; vector dp(s.size() + 1, 0); dp[0] = 阅读全文
posted @ 2019-04-09 12:10
JohnRed
阅读(87)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector subsetsWithDup(vector &S) { if (S.empty()) return {}; vector res(1); sort(S.begin(), S.end()); int size = 1, last 阅读全文
posted @ 2019-04-09 12:08
JohnRed
阅读(86)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector grayCode(int n) { vector result; for(int i=0;i>1); } return result; } }; ``` 阅读全文
posted @ 2019-04-09 12:07
JohnRed
阅读(91)
评论(0)
推荐(0)
摘要:
``` class Solution { public: void merge(vector& nums1, int m, vector& nums2, int n) { int i = m - 1, j = n - 1, k = m + n - 1; while (i >= 0 && j >= 0) { if (nums1[i] >... 阅读全文
posted @ 2019-04-09 12:04
JohnRed
阅读(64)
评论(0)
推荐(0)
摘要:
``` 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
阅读(65)
评论(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
阅读(109)
评论(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
阅读(68)
评论(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
阅读(77)
评论(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
阅读(87)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int removeDuplicates(int A[], int n) { if (n 阅读全文
posted @ 2019-04-09 11:17
JohnRed
阅读(82)
评论(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
阅读(130)
评论(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
阅读(100)
评论(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
阅读(96)
评论(0)
推荐(0)
摘要:
``` class Solution { public: string minWindow(string s, string t) { string res = ""; unordered_map letterCnt; int left = 0, cnt = 0, minLen = INT_MAX; for (char c :... 阅读全文
posted @ 2019-04-09 11:10
JohnRed
阅读(81)
评论(0)
推荐(0)
摘要:
``` public class Solution { public void sortColors(int[] nums) { int red = 0; int blue = nums.length 1; for(int i=0; i 阅读全文
posted @ 2019-04-09 11:08
JohnRed
阅读(73)
评论(0)
推荐(0)
摘要:
``` public boolean searchMatrix(int[][] matrix, int target) { if (matrix == null || matrix[0][0] target) return false; int rowLen = matrix.length; int 阅读全文
posted @ 2019-04-09 11:07
JohnRed
阅读(79)
评论(0)
推荐(0)
摘要:
``` class Solution { public: void setZeroes(vector &matrix) { if (matrix.empty() || matrix[0].empty()) return; int m = matrix.size(), n = matrix[0].si 阅读全文
posted @ 2019-04-09 11:04
JohnRed
阅读(144)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int minDistance(string word1, string word2) { int m = word1.size(), n = word2.size(); vector dp(m + 1, vector(n + 1)); fo 阅读全文
posted @ 2019-04-09 11:02
JohnRed
阅读(97)
评论(0)
推荐(0)
摘要:
``` class Solution { public: string simplifyPath(string path) { string res, t; stringstream ss(path); vector v; while (getline(ss, t, '/')) { if (t == "... 阅读全文
posted @ 2019-04-09 11:01
JohnRed
阅读(81)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int climbStairs(int n) { if (n == 1) return 1; int first = 1; int second = 2; for(int i = 3; i 阅读全文
posted @ 2019-04-09 10:59
JohnRed
阅读(90)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int mySqrt(int x) { if (x = mid) left = mid + 1; else right = mid; } return right - 1; } }; ``` ``` class Solution { public: ... 阅读全文
posted @ 2019-04-09 10:52
JohnRed
阅读(80)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: string addBinary(string& a, string& b) { string res = ""; int m = a.size() - 1, n = b.size() - 1, carry = 0; while (m >= 0 || n >= 0) { ... 阅读全文
posted @ 2019-04-09 10:50
JohnRed
阅读(76)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector plusOne(vector &digits) { int n = digits.size(); for (int i = n - 1; i >= 0; --i) { if (digits[i] == 9) digits[i] = 0; e... 阅读全文
posted @ 2019-04-09 10:47
JohnRed
阅读(78)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isNumber(string s) { bool num = false, numAfterE = true, dot = false, exp = false, sign = false; int n = s.size(); f 阅读全文
posted @ 2019-04-09 10:41
JohnRed
阅读(94)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int minPathSum(vector &grid) { int m = grid.size(), n = grid[0].size(); int dp[m][n]; dp[0][0] = grid[0][0]; for (int i = 阅读全文
posted @ 2019-04-09 10:39
JohnRed
阅读(79)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int uniquePathsWithObstacles(vector & obstacleGrid) { if (obstacleGrid.empty() || obstacleGrid[0].empty() || obstacleGrid 阅读全文
posted @ 2019-04-09 10:38
JohnRed
阅读(74)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int uniquePaths(int m, int n) { vector dp(n, 1); for (int i = 1; i 阅读全文
posted @ 2019-04-09 10:36
JohnRed
阅读(81)
评论(0)
推荐(0)
摘要:
``` class Solution { public: ListNode *rotateRight(ListNode *head, int k) { if (!head) return NULL; int n = 1; ListNode *cur = head; while (cur->next) { ... 阅读全文
posted @ 2019-04-09 10:35
JohnRed
阅读(93)
评论(0)
推荐(0)
摘要:
``` class Solution { public: string getPermutation(int n, int k) { string res; string num = "123456789"; vector f(n, 1); for (int i = 1; i = 1; --i) { i... 阅读全文
posted @ 2019-04-09 10:33
JohnRed
阅读(74)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector > generateMatrix(int n) { vector > res(n, vector(n, 0)); int val = 1, p = n; for (int i = 0; i = i; --col) res[i + p - 1... 阅读全文
posted @ 2019-04-09 10:31
JohnRed
阅读(91)
评论(0)
推荐(0)
摘要:
```
class Solution {
public: int lengthOfLastWord(string s) { int right = s.size() - 1, res = 0; while (right >= 0 && s[right] == ' ') --right; while (right >= 0 && s[right... 阅读全文
posted @ 2019-04-09 10:29
JohnRed
阅读(78)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector insert(vector& intervals, Interval newInterval) { vector res; int n = intervals.size(), cur = 0; while (cur 阅读全文
posted @ 2019-04-09 10:26
JohnRed
阅读(86)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector merge(vector& intervals) { if (intervals.empty()) return {}; sort(intervals.begin(), intervals.end(), "" {return a 阅读全文
posted @ 2019-04-09 10:24
JohnRed
阅读(87)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool canJump(vector& nums) { vector dp(nums.size(), 0); for (int i = 1; i & nums) { int n = nums.size(), reach = 0; for (int i = 0; i ... 阅读全文
posted @ 2019-04-09 10:22
JohnRed
阅读(97)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector spiralOrder(vector > &matrix) { if (matrix.empty() || matrix[0].empty()) return {}; int m = matrix.size(), n = matrix[0].size(); vector ... 阅读全文
posted @ 2019-04-09 10:21
JohnRed
阅读(78)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int maxSubArray(vector& nums) { int res = INT_MIN, curSum = 0; for (int num : nums) { curSum = max(curSum + num, num); res = ma... 阅读全文
posted @ 2019-04-09 10:19
JohnRed
阅读(90)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int totalNQueens(int n) { int res = 0; vector pos(n, 1); totalNQueensDFS(pos, 0, res); return res; } void totalNQueensDFS 阅读全文
posted @ 2019-04-09 10:18
JohnRed
阅读(91)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector solveNQueens(int n) { vector res; vector pos(n, 1); solveNQueensDFS(pos, 0, res); return res; } void solveNQueensD 阅读全文
posted @ 2019-04-09 10:16
JohnRed
阅读(101)
评论(0)
推荐(0)
摘要:
``` class Solution { public: double myPow(double x, int n) { double res = 1.0; for (int i = n; i != 0; i /= 2) { if (i % 2 != 0) res = x; x = x; } ret 阅读全文
posted @ 2019-04-09 10:15
JohnRed
阅读(119)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector anagrams(vector &strs) { string s; map anagram; vector res; for (int i = 0; i = 0) { res.push_back(strs[anag... 阅读全文
posted @ 2019-04-09 10:11
JohnRed
阅读(116)
评论(0)
推荐(0)
摘要:
``` class Solution { public: void rotate(vector &matrix) { int n = matrix.size(); for (int i = 0; i 阅读全文
posted @ 2019-04-09 10:10
JohnRed
阅读(80)
评论(0)
推荐(0)
摘要:
```class Solution { public: vector> permuteUnique(vector& nums) { vector> res; vector out, visited(nums.size(), 0); sort(nums.begin(), nums.end()); permuteUniqueDFS... 阅读全文
posted @ 2019-04-09 10:05
JohnRed
阅读(96)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector permute(vector& num) { vector res; vector out, visited(num.size(), 0); permuteDFS(num, 0, visited, out, res); retu 阅读全文
posted @ 2019-04-09 10:04
JohnRed
阅读(77)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int jump2(vector& nums) { int res = 0, n = nums.size(), last = 0, cur = 0; for (int i = 0; i = n - 1) break; } } return res... 阅读全文
posted @ 2019-04-09 10:02
JohnRed
阅读(80)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isMatch(string s, string p) { int m = s.size(), n = p.size(); vector dp(m + 1, vector(n + 1, false)); dp[0][0] = tru 阅读全文
posted @ 2019-04-09 10:01
JohnRed
阅读(81)
评论(0)
推荐(0)
摘要:
``` class Solution { public: string multiply(string num1, string num2) { int n1 = num1.size(), n2 = num2.size(); vector tmpres(n1+n2, 0); int k = n1 + n2 - 2; for(i... 阅读全文
posted @ 2019-04-09 09:59
JohnRed
阅读(83)
评论(0)
推荐(0)
摘要:
class Solution { public: int trap(vector& height) { int l = 0, r = height.size() 1, level = 0, res = 0; while (l 阅读全文
posted @ 2019-04-09 09:57
JohnRed
阅读(103)
评论(0)
推荐(0)
摘要:
``` class Solution { public: int firstMissingPositive(vector& nums) { int n = nums.size(); for (int i = 0; i 0 && nums[i] 阅读全文
posted @ 2019-04-09 09:55
JohnRed
阅读(83)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector combinationSum2(vector &num, int target) { vector result; vector subsets; vector empty; subsets.push_back(empty); 阅读全文
posted @ 2019-04-09 09:52
JohnRed
阅读(82)
评论(0)
推荐(0)
摘要:
``` class Solution { public: vector combinationSum(vector& candidates, int target) { vector res; combinationSumDFS(candidates, target, 0, {}, res); re 阅读全文
posted @ 2019-04-09 09:49
JohnRed
阅读(101)
评论(0)
推荐(0)
摘要:
``` class Solution { public: string countAndSay(int n) { if (n 阅读全文
posted @ 2019-04-09 09:48
JohnRed
阅读(89)
评论(0)
推荐(0)
摘要:
``` class Solution { public: void solveSudoku(vector &board) { if (board.empty() || board.size() != 9 || board[0].size() != 9) return; solveSudokuDFS( 阅读全文
posted @ 2019-04-09 09:40
JohnRed
阅读(84)
评论(0)
推荐(0)
摘要:
``` class Solution { public: bool isValidSudoku(vector &board) { if (board.empty() || board[0].empty()) return false; int m = board.size(), n = board[ 阅读全文
posted @ 2019-04-09 09:38
JohnRed
阅读(78)
评论(0)
推荐(0)

浙公网安备 33010602011771号