fucking-algorithm
fucking-algorithm copied to clipboard
刷算法全靠套路,认准 labuladong 就够了!English version supported! Crack LeetCode, not only how, but also why.
### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.cn/problems/reverse-nodes-in-k-group/description/ ### 报错信息 `pre, cur, nxt := nil, head, head` use of untyped nil in assignment (solution.go) ### 你是否愿意提交...
### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.com/problems/3sum/ ### 报错信息 python for循环中对i进行i+=1的操作起不到跳过的作用, 需要这样修改 ### 你是否愿意提交 PR 修复这个 bug? - [X] 我愿意!
优化二分查找, 用更直观简单的方法找左右边界 
### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.cn/problems/string-to-integer-atoi/description/ ### 报错信息 Wrong Answer 930/1088 cases passed (N/A) Testcase "-91283472332" Answer -9128347233 Expected Answer -2147483648 ### 你是否愿意提交 PR...
1. 系统:macOs 2. 问题  就最近老出现这个问题,我账号密码登录和使用官网cookies登录都不能正常使用。
### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.com/problems/path-sum-iii/ ### 报错信息  ### 你是否愿意提交 PR 修复这个 bug? - [X] 我愿意!
### 请在提交 bug 之前先搜索 - [x] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.com/problems/open-the-lock/description/ ### 报错信息 python解法中用的python3,即声明了return type,然而plusOne和minusOne都和openLock位于同一级并且定义在openLock之后,需要将plusOne和minusOne前移,并且参数中包含self,或者置于openLock中,在使用前定义 我的代码(已AC): ``` class Solution: def openLock(self, deadends: List[str], target: str) -> int: deads =...
### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.cn/problems/corporate-flight-bookings/description/ ### 报错信息 Line 55: error: class, interface, enum, or record expected } ### 你是否愿意提交 PR 修复这个 bug? -...
### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.cn/problems/minimum-height-trees/description/ ### 报错信息 编译出错 Line 41: error: reached end of file while parsing } ^ ### 你是否愿意提交 PR 修复这个...
## 背景 为了帮助大家更好地学习算法,我之前写了很多算法教程,并开发了一系列刷题插件,统称为《labuladong 的刷题全家桶》,详情见 [这里](https://labuladong.github.io/article/fname.html?fname=全家桶简介)。 在我的教程和插件中的解法主要使用的是 Java 语言,原因是 Java 这门语言中规中矩,就算之前没有接触过,也能比较容易看懂逻辑。不过现在这不是 chatGPT 横空出世了嘛,我就借助 chatGPT 把我的解法改写成多种语言,希望对不同技术背景的小伙伴更加友好。 chatGPT 的改写效果还是非常不错的,不过难免还是存在一些错误,所以我希望能够和大家一起来修正这些错误。 ## 如何反馈错误 如果你发现某些解法代码不能通过力扣的所有测试用例(一般都是 chatGPT 改写的解法代码会出现这种情况,我的解法代码都是通过测试才发布的),可以 [点这里](https://github.com/labuladong/fucking-algorithm/issues/new?assignees=&labels=code+bug&template=bug_report.yml&title=%5Bbug%5D%5B%7B%E8%BF%99%E9%87%8C%E6%9B%BF%E6%8D%A2%E4%B8%BA%E5%87%BA%E9%94%99%E7%9A%84%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80%7D%5D+%7B%E8%BF%99%E9%87%8C%E6%9B%BF%E6%8D%A2%E4%B8%BA%E5%87%BA%E9%94%99%E7%9A%84%E5%8A%9B%E6%89%A3%E9%A2%98%E7%9B%AE%E6%A0%87%E8%AF%86%E7%AC%A6%7D+) 按照模板提交 issue,我和其他小伙伴会提交 PR 修复这些错误。 我已经把大部分出错的代码都总结到 issue 列表了,并标记了 `help...