![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Breadth-first Search
文章平均质量分 89
Vendredimatin
这个作者很懒,什么都没留下…
展开
-
洛谷搜索题单(BFS/DFS)13道题总结
洛谷搜索题单(BFS/DFS)13道题总结P1219 八皇后经典深搜问题,本题的难点在于如何判断斜线上是否已有棋子,可使用数学中斜率和截距来判断是否是在同一条直线上。P2392 kkksc03考前临时抱佛脚深搜问题,但本题又是01背包问题,把作业分别放进左脑和右脑,最后去左脑和右脑的最大值就是该课的最终结果,一开始想得太复杂了,想把左脑和右脑一起处理。因此应该将搜索简单化,编写代码时尽量简化状态背包容量相当于t/2,最好的结果当然是t/2,意味着左脑和右脑之间没有时间差,即求时间差尽量小,单脑时间原创 2021-07-25 23:43:07 · 1710 阅读 · 0 评论 -
Leetcode 279. Perfect Squares
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.Example 1:Input: n = 12Output: 3Explanation: 12 = 4 + 4 + 4.Example 2:Inp...原创 2020-02-09 20:16:50 · 118 阅读 · 0 评论 -
Leetcode 127. Word Ladder
Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be changed at a tim...原创 2020-02-09 20:16:21 · 128 阅读 · 0 评论