摘要: 1 class Solution 2 { 3 public: 4 int removeDuplicates(vector<int>& nums) 5 { 6 int j = 0; 7 for(int i = 0;i < nums.size();i ++) 8 { 9 if(j < 2 || nums 阅读全文
posted @ 2020-03-30 22:23 Jinxiaobo0509 阅读(65) 评论(0) 推荐(0)
摘要: 1 //删除重复数模板 2 class Solution 3 { 4 public: 5 int removeDuplicates(vector<int>& nums) 6 { 7 int i = 0; 8 for(int j = 0;j < nums.size();j ++) 9 if(i < k 阅读全文
posted @ 2020-03-30 22:21 Jinxiaobo0509 阅读(126) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int dir[4][4]={{-1,0},{1,0},{0,-1},{0,1}}; 5 6 bool exist(vector<vector<char>>& board, string word) 7 { 8 int m=board 阅读全文
posted @ 2020-03-30 21:37 Jinxiaobo0509 阅读(105) 评论(0) 推荐(0)
摘要: 1 //直接套模板 2 class Solution 3 { 4 vector<vector<int>> res; 5 void helper(vector<int>& nums, int start, vector<int>& out) 6 { 7 res.push_back(out); 8 9 阅读全文
posted @ 2020-03-30 19:32 Jinxiaobo0509 阅读(118) 评论(0) 推荐(0)
摘要: 1 //直接套模板 2 class Solution 3 { 4 vector<vector<int>> res; 5 void helper(vector<int>& nums, int start, vector<int>& out,int k) 6 { 7 if(k == out.size() 阅读全文
posted @ 2020-03-30 19:16 Jinxiaobo0509 阅读(107) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 void sortColors(vector<int>& nums) 5 { 6 int n = nums.size(); 7 int begin = -1; 8 int end = n; 9 int i = 0; 10 while( 阅读全文
posted @ 2020-03-30 19:00 Jinxiaobo0509 阅读(102) 评论(0) 推荐(0)
摘要: 1 void partition(int arr[], int l, int r, int num)//三路快排 2 { 3 int less = l - 1; 4 int more = r + 1; 5 int cur = 0; 6 while (cur < more) 7 { 8 if (arr 阅读全文
posted @ 2020-03-30 18:59 Jinxiaobo0509 阅读(142) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 int dx[4] = {1,0,-1,0}; 4 int dy[4] = {0,1,0,-1}; 5 public: 6 void setZeroes(vector<vector<int>>& matrix) 7 { 8 int m = matrix. 阅读全文
posted @ 2020-03-30 18:23 Jinxiaobo0509 阅读(118) 评论(0) 推荐(0)
摘要: 1 // "/a//b////c/d//././/.." 2 class Solution 3 { 4 vector<string> res; 5 void spilt(string s,char c,vector<string> &res) 6 { 7 istringstream iss(s); 阅读全文
posted @ 2020-03-30 17:05 Jinxiaobo0509 阅读(117) 评论(0) 推荐(0)
摘要: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), 阅读全文
posted @ 2020-03-30 16:13 Jinxiaobo0509 阅读(125) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int firstMissingPositive(vector<int>& nums) 5 { 6 int minV = INT_MAX; 7 int maxV = INT_MIN; 8 int n = nums.size(); 9 阅读全文
posted @ 2020-03-30 15:07 Jinxiaobo0509 阅读(101) 评论(0) 推荐(0)