labuladong / fucking-algorithm

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

Home Page:https://labuladong.github.io/algo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

网站第一章nSum问题中的3Sum的java代码有错误

aj-web opened this issue · comments

请在提交 bug 之前先搜索

  • 我已经搜索过 issues,没有发现相同的 bug。

出错的题目链接

https://leetcode.cn/problems/3sum/description/

报错信息

第一章:一个方法团灭nSum问题
twoSumTarget方法代码中使用res.add(Arrays.asList(left, right))。asList方法生成的list容量固定。threeSumTarget方法中直接对该list使用add方法报错。leetCode官网的解法代码没有问题,使用res.add(new ArrayList<>(Arrays.asList(left, right)));

你是否愿意提交 PR 修复这个 bug?

  • 我愿意!