Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4Sum #16

Open
barretlee opened this issue Aug 2, 2017 · 4 comments
Open

4Sum #16

barretlee opened this issue Aug 2, 2017 · 4 comments

Comments

@barretlee
Copy link
Owner

barretlee commented Aug 2, 2017

本题难度:★★

给定一个长度为 n 的整数数组 S,找出所有的非重复四元组 (a, b, c, d) 使得 a + b + c + d = target,如:

给定数组 S = [1, 0, -1, 0, -2, 2], target = 0,
那么输出结果为:

[
  [-1,  0, 0, 1],
  [-2, -1, 1, 2],
  [-2,  0, 0, 2]
]

要求:

  1. 输出的四元组按照顺序排列,即 a ≤ b ≤ c ≤ d;
  2. 最后的输出结果不存在重复元组.
@tonymiao2012
Copy link

建议直接在leetcode上做。Online judge这样会更快一些。当然你这样做可能处于自己的考虑,赞一个

@pengkobe
Copy link

@tonymiao2012 此 repo 看来要沉了。

@barretlee
Copy link
Owner Author

实验性的 repo,从小密圈发起的。

本来打算试行一周,坚持了两三周,还是有点吃力。

算法这个东西,适合一个人默默的搞,把结果和分析发出来,不太适合聚众讨论,尤其是这种需要大量 test case 的题目,还是去 leetcode 专业平台上玩比较有意思。

最近工作也比较忙,生活上的事情也比较多,有些顾不上了。

不过搞不好,过几个月清闲了,时间充裕了,还是会回来折腾的,到时候可能会换一个形式。

@tonymiao2012
Copy link

加油吧。刷题是很占用时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants