摘要:
``` 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
阅读(78)
评论(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
阅读(71)
评论(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
阅读(76)
评论(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
阅读(143)
评论(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
阅读(95)
评论(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
阅读(77)
评论(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
阅读(87)
评论(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
阅读(78)
评论(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
阅读(74)
评论(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
阅读(75)
评论(0)
推荐(0)

浙公网安备 33010602011771号