会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
张宵
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
7
8
9
10
11
12
13
14
15
···
22
下一页
2021年6月21日
有重复值的全排列
摘要: 题目链接:https://leetcode-cn.com/problems/permutations-ii/ 题目描述: 题解: class Solution { public: vector<vector<int>> result; vector<int> path; void backTrack
阅读全文
posted @ 2021-06-21 09:52 张宵
阅读(60)
评论(0)
推荐(0)
2021年6月20日
无重复字符的最长子串
摘要: 题目链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 题目描述: 题解: class Solution { public: int lengthOfLongestSubstring(
阅读全文
posted @ 2021-06-20 17:51 张宵
阅读(26)
评论(0)
推荐(0)
2021年6月19日
串联字符串的最大长度
摘要: 题目链接:串联字符串的最大长度 题目描述: 题解: class Solution { public: int maxLen = 0; void backTracking(vector<string>& arr, int index, vector<int>& letters) { int len =
阅读全文
posted @ 2021-06-19 17:12 张宵
阅读(57)
评论(0)
推荐(0)
2021年6月18日
翻转字符串里的单词
摘要: 题目链接:https://leetcode-cn.com/problems/reverse-words-in-a-string/ 题目描述: 题解: class Solution { public: string reverseWords(string s) { stack <string> stk
阅读全文
posted @ 2021-06-18 10:53 张宵
阅读(27)
评论(0)
推荐(0)
2021年6月17日
柠檬水找零
摘要: 题目链接: https://leetcode-cn.com/problems/lemonade-change/ 题目描述: 题解: class Solution { public: bool lemonadeChange(vector<int>& bills) { unordered_map<int
阅读全文
posted @ 2021-06-17 11:26 张宵
阅读(30)
评论(0)
推荐(0)
反转字符串
摘要: 题目链接: https://leetcode-cn.com/problems/reverse-string-ii/ 题目描述: 题解: 要点:遍历的步长为2 * k。当需要固定规律一段一段去处理字符串的时候,要想想在在for循环的表达式上做做文章。 class Solution { public:
阅读全文
posted @ 2021-06-17 10:50 张宵
阅读(35)
评论(0)
推荐(0)
2021年6月16日
替换空格
摘要: 题目链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/ 题目描述: 题解: 空间复杂度:O(1) 1.先找出字符串中含有多少个空格 2.对原字符串空间扩容 3.定义两个指针,一个指向新字符串的末尾,一个指向原始字符串的末尾 class
阅读全文
posted @ 2021-06-16 14:48 张宵
阅读(36)
评论(0)
推荐(0)
分发糖果
摘要: 题目链接:https://leetcode-cn.com/problems/candy/ 题目描述: 题解: class Solution { public: int candy(vector<int>& ratings) { vector<int> candyVec(ratings.size(),
阅读全文
posted @ 2021-06-16 11:13 张宵
阅读(31)
评论(0)
推荐(0)
2021年6月15日
回文链表
摘要: 题目链接:https://leetcode-cn.com/problems/palindrome-linked-list/ 题目描述: 题解: /** * Definition for singly-linked list. * struct ListNode { * int val; * List
阅读全文
posted @ 2021-06-15 15:33 张宵
阅读(25)
评论(0)
推荐(0)
2021年6月14日
加油站
摘要: 题目链接:https://leetcode-cn.com/problems/gas-station/ 题目描述: 题解: 1.如果gas的总和小于cost总和,一定不能跑一整圈。 2.每个加油站剩余量rest[i] = gas[i] - cost[i] 3.i从0开始累加rest[i],和记为cur
阅读全文
posted @ 2021-06-14 11:07 张宵
阅读(54)
评论(0)
推荐(0)
上一页
1
···
7
8
9
10
11
12
13
14
15
···
22
下一页
公告