fucking-algorithm icon indicating copy to clipboard operation
fucking-algorithm copied to clipboard

刷算法全靠套路,认准 labuladong 就够了!English version supported! Crack LeetCode, not only how, but also why.

Results 336 fucking-algorithm issues
Sort by recently updated
recently updated
newest added

### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.com/problems/find-k-pairs-with-smallest-sums/description/ ### 报错信息 Wrong Answer 19 / 35 testcases passed Input nums1 = [1,2,4,5,6] nums2 = [3,5,7,9] k =...

help wanted

Fixes https://github.com/labuladong/fucking-algorithm/issues/1420 我修改的是如下题目的 cpp 解法: https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iii/description/ 通过截图如下:

### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iii/description/ ### 报错信息 解答错误 prices = [3,3,5,0,0,3,1,4] 输出 1770442982 原因:dp数组未初始化 ### 你是否愿意提交 PR 修复这个 bug? - [X] 我愿意!

help wanted

Fixes [#1116](https://github.com/labuladong/fucking-algorithm/issues/1116) 我修改的是如下题目的 Java 解法: https://leetcode.cn/problems/minimum-number-of-arrows-to-burst-balloons/ 通过截图如下: ![fix-452](https://github.com/labuladong/fucking-algorithm/assets/116126054/04b3fdd7-7a9f-4ef4-9509-e087aee9035d)

Fixes #1335 我修改的是如下题目的 所有 解法: https://leetcode.cn/problems/gu-piao-de-zui-da-li-run-lcof/ 通过截图如下: ![fix-lcof-63](https://github.com/labuladong/fucking-algorithm/assets/116126054/a87b78b9-bffa-4a76-a7ef-ad23eb5974b0)

Fixes #1314 我修改的是如下题目的 Python 解法: https://leetcode.cn/problems/er-cha-shu-de-shen-du-lcof/ 通过截图如下: ![fix-lcof-55](https://github.com/labuladong/fucking-algorithm/assets/116126054/aad4184c-2f06-488d-8a00-0e230e269162)

Fixes [#1386](https://github.com/labuladong/fucking-algorithm/issues/1386) 我修改的是如下题目的 java 解法,包括其他版本语言也一并修改了: https://leetcode.cn/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof 通过截图如下: ![java通过截图](https://github.com/labuladong/fucking-algorithm/assets/52874599/369cccb5-76b7-4b81-ac3c-d32f763f1ffd) 修改原因:原代码对特殊情况的处理有些问题(最终返回值不应该是0,而应该是0对应的索引值),导致某些测试用例无法通过,所以修改了部分代码,但整体思想没有改变,所有语言都通过了测试

### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.com/problems/find-k-pairs-with-smallest-sums/description/ ### 报错信息 Wrong Answer 19 / 35 testcases passed Input nums1 = [1,2,4,5,6] nums2 = [3,5,7,9] k =...

help wanted

### 请在提交 bug 之前先搜索 - [X] 我已经搜索过 [issues](https://github.com/labuladong/fucking-algorithm/issues),没有发现相同的 bug。 ### 出错的题目链接 https://leetcode.com/problems/interleaving-string/description/?show=1 ### 报错信息 代码没错,不过comment不对。现comment 如下: # 如果,s1[i] 匹配不了,s2[j] 可以匹配,那么填入 s2[j] 试一下 if j < len(s2) and s2[j] == s3[k]:...

help wanted

Fixes https://github.com/labuladong/fucking-algorithm/issues/1399 我修改的是如下题目的 python 解法: https://leetcode.cn/problems/8Zf90G/ (我不懂为什么把整数形改成float就能通过测试,如果大神有空的话,求赐教呀~) 通过截图如下: