随笔 - 52  文章 - 50  评论 - 1  阅读 - 24839

文章分类 -  Leetcode

二叉树
摘要:题目:95. 不同的二叉搜索树 II https://leetcode-cn.com/problems/unique-binary-search-trees-ii/ 解析:https://leetcode-cn.com/problems/unique-binary-search-trees-ii/s 阅读全文
posted @ 2022-04-18 11:09 蜀山菜鸟 阅读(13) 评论(0) 推荐(0) 编辑
回溯算法
摘要:建议阅读原文:https://blog.csdn.net/weiyuefei/article/details/79316653 递归: //针对N叉树的递归回溯方法 void backtrack (int t) { if (t>n) output(x); //叶子节点,输出结果,x是可行解 else 阅读全文
posted @ 2022-04-16 14:46 蜀山菜鸟 阅读(23) 评论(0) 推荐(0) 编辑
IO操作
摘要:输入示例:第一行个数,后面为成对的值 输入样例 1 3 0 0 1 0 2 0 int Test_Main() { int nline; vector<pair<int,int>> data; cin >> nline; while (nline > 0) { int l, r; cin >> l 阅读全文
posted @ 2022-04-12 20:33 蜀山菜鸟 阅读(31) 评论(0) 推荐(0) 编辑
priority_queue优先级队列
摘要:头文件:#include <queue> 定义:priority_queue<Type, Container, Functional> Type 就是数据类型,Container 就是容器类型(Container必须是用数组实现的容器,比如vector,deque等等,但不能用 list。STL里面 阅读全文
posted @ 2022-04-11 17:59 蜀山菜鸟 阅读(30) 评论(0) 推荐(0) 编辑
752. 打开转盘锁
摘要:752. 打开转盘锁 你有一个带有四个圆形拨轮的转盘锁。每个拨轮都有10个数字: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' 。每个拨轮可以自由旋转:例如把 '9' 变为 '0','0' 变为 '9' 。每次旋转都只能旋转一个拨轮的一位数字。 阅读全文
posted @ 2022-04-09 15:32 蜀山菜鸟 阅读(122) 评论(0) 推荐(0) 编辑
leetcode 1162. 地图分析 和 994. 腐烂的橘子
摘要:1162. 地图分析 题目:https://leetcode-cn.com/problems/as-far-from-land-as-possible/ 你现在手里有一份大小为 n x n 的 网格 grid,上面的每个 单元格 都用 0 和 1 标记好了。其中 0 代表海洋,1 代表陆地。 请你找 阅读全文
posted @ 2022-04-09 11:00 蜀山菜鸟 阅读(28) 评论(0) 推荐(0) 编辑
leetcode 253. 会议室 II 和1229. 安排会议日程
摘要:给你一个会议时间安排的数组 intervals ,每个会议时间都会包括开始和结束的时间 intervals[i] = [starti, endi] ,返回 所需会议室的最小数量 。 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/meeting- 阅读全文
posted @ 2022-04-07 22:04 蜀山菜鸟 阅读(361) 评论(0) 推荐(0) 编辑
leetcode 22. 单词转换
摘要:给定字典中的两个词,长度相等。写一个方法,把一个词转换成另一个词, 但是一次只能改变一个字符。每一步得到的新词都必须能在字典中找到。 编写一个程序,返回一个可能的转换序列。如有多个可能的转换序列,你可以返回任何一个。 来源:力扣(LeetCode)链接:https://leetcode-cn.com 阅读全文
posted @ 2022-04-07 19:50 蜀山菜鸟 阅读(98) 评论(0) 推荐(0) 编辑
【滑动窗口】016. 不含重复字符的最长子字符串
摘要:题目链接:https://leetcode-cn.com/problems/wtcaE1/ class Solution { public: int lengthOfLongestSubstring(string s) { map<char,int> cntMap; int max = 0; que 阅读全文
posted @ 2022-03-26 16:03 蜀山菜鸟 阅读(12) 评论(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

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