• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 42 下一页
2018年11月4日
Leetcode 526
摘要: 1 2 3 4 5 5 2 3 4 1 4 2 3 5 1 3 2 4 5 1 2 3 4 5 1 发现排列到最后最后一个数字是不变的,当然这和交换顺序有关,所以在判断的时候要选择不变的每次递归最后的数字判断! 阅读全文
posted @ 2018-11-04 17:51 村雨sup 阅读(121) 评论(0) 推荐(0)
2018年11月1日
Leetcode 90
摘要: // 重复元素在去重的时候会出现顺序不同去不了重,这时候需要对add进行排序class Solution { public: vector> subsetsWithDup(vector& nums) { vector> res; vector add; for(int i=0;i > gg(res.begin(),res.end()); ... 阅读全文
posted @ 2018-11-01 12:52 村雨sup 阅读(119) 评论(0) 推荐(0)
2018年10月30日
Leetcode 22
摘要: //这题感觉不如前两题回溯清楚,还要再看看class Solution { public: vector generateParenthesis(int n) { vector res; string add; DFS(res,add,n,n); return res; } void DFS(vec... 阅读全文
posted @ 2018-10-30 22:10 村雨sup 阅读(108) 评论(0) 推荐(0)
Leetcode 17
摘要: //狂练回溯,巧用备胎class Solution { public: vector letterCombinations(string digits) { vector res; if(digits == "") return res; string add; DFS(res,add,digits,0); ... 阅读全文
posted @ 2018-10-30 17:16 村雨sup 阅读(145) 评论(0) 推荐(0)
Leetcode 79
摘要: //这是我写过最难的递归了。。。//class Solution { public: bool exist(vector>& board, string word) { int m = board.size(); int n = board[0].size(); for(int i=0;i >& board,string word,int ... 阅读全文
posted @ 2018-10-30 15:21 村雨sup 阅读(190) 评论(0) 推荐(0)
2018年10月28日
Leetcode 78
摘要: //和77类似的问题,可以放在一起记忆class Solution { public: vector> subsets(vector& nums) { vector> res; vector add; res.push_back(add); for(int i=1;i >& res,vector &add,vector& n... 阅读全文
posted @ 2018-10-28 21:08 村雨sup 阅读(145) 评论(0) 推荐(0)
Leetcode 77
摘要: //这似乎是排列组合的标准写法了已经class Solution { public: vector> combine(int n, int k) { vector> res; vector add; DFS(res,k,n,add,0); return res; } void DFS(vector>... 阅读全文
posted @ 2018-10-28 20:41 村雨sup 阅读(97) 评论(0) 推荐(0)
2018年10月27日
Leetcode 75
摘要: - 定义red指针指向开头位置,blue指针指向末尾位置 - 从头开始遍历原数组,如果遇到0,则交换该值和red指针指向的值,并将red指针后移一位。若遇到2,则交换该值和blue指针指向的值,并将blue指针前移一位。若遇到1,则继续遍历。 阅读全文
posted @ 2018-10-27 23:50 村雨sup 阅读(111) 评论(0) 推荐(0)
Leetcode 74
摘要: class Solution { public: bool searchMatrix(vector>& matrix, int target) { int m = matrix.size(); if(!m) return false; int n = matrix[0].size(); if(!n) return false... 阅读全文
posted @ 2018-10-27 23:34 村雨sup 阅读(204) 评论(0) 推荐(0)
2018年10月23日
Leetcode 73
摘要: class Solution { public: void setZeroes(vector>& matrix) { vector> store; int m = matrix.size(); int n = matrix[0].size(); for(int i=0;i temp; ... 阅读全文
posted @ 2018-10-23 16:34 村雨sup 阅读(124) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 42 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3