随笔分类 -  LeetCode

LeetCode 210. 课程表 II
摘要:LeetCode 210. 课程表 II题解 阅读全文

posted @ 2022-04-08 15:17 翔鸽 阅读(26) 评论(0) 推荐(0) 编辑

LeetCode 825. 适龄的朋友
摘要:LeetCode 825. 适龄的朋友题解 阅读全文

posted @ 2022-04-07 11:00 翔鸽 阅读(21) 评论(0) 推荐(0) 编辑

LeetCode 424. 替换后的最长重复字符
摘要:LeetCode 424. 替换后的最长重复字符 题解 阅读全文

posted @ 2022-04-05 14:47 翔鸽 阅读(46) 评论(0) 推荐(0) 编辑

LeetCode 438 找到字符串中所有字母异位词
摘要:LeetCode 438 找到字符串中所有字母异位词 题解 阅读全文

posted @ 2022-04-04 19:06 翔鸽 阅读(19) 评论(0) 推荐(0) 编辑

LeetCode 413. 等差数列划分
摘要:Leetcode 413. 等差数列划分题解 阅读全文

posted @ 2022-03-31 20:17 翔鸽 阅读(40) 评论(0) 推荐(0) 编辑

LeetCode416分割等和子集
摘要:416. 分割等和子集 - 力扣(LeetCode) 这道题属于01背包的变形,我们首先根据题意将其转换为01背包问题,01背包的意思是在容量为W的背包中每个物品只能选一次所能容纳的最大价值,这道题的意思是在容量为W的背包中能否选择一定物品使其恰好装满。 01背包的状态转移方程:$$dp[i] [j 阅读全文

posted @ 2021-09-21 16:35 翔鸽 阅读(27) 评论(0) 推荐(0) 编辑

LeetCode554——砖墙
摘要:554. 砖墙 - 力扣(LeetCode) (leetcode-cn.com) 大致思路:按照题目描述直接判断虚线穿过了多少道墙,需要考虑墙的边界条件等问题很难判断。但是我们可以反向思考,要让虚线穿过的砖的数目最少,等同于让虚线穿过的缝隙最多。因此我们可以求出虚线穿过的缝隙数目的最大值,再用砖块的 阅读全文

posted @ 2021-05-02 11:17 翔鸽 阅读(75) 评论(0) 推荐(0) 编辑

LeetCode第235场周赛题解
摘要:LeetCode第235场周赛题解 截断句子 按照题目要求模拟即可,把单词读入到vector中,然后按要求拼接即可 class Solution { public: string truncateSentence(string s, int k) { vector<string> a; string 阅读全文

posted @ 2021-04-04 13:37 翔鸽 阅读(65) 评论(0) 推荐(0) 编辑

LeetCode第49场双周赛题解
摘要:LeetCode第49场双周赛题解 判断国际象棋棋盘中一个格子的颜色 如果是a,c,e,g列,行数是偶数即为白格子,如果是b,d,f,h列,行数为奇数即为白格子 class Solution { public: bool squareIsWhite(string coordinates) { cha 阅读全文

posted @ 2021-04-04 09:50 翔鸽 阅读(68) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示