The Wayback Machine - https://web.archive.org/web/20200906194230/https://github.com/greyireland/algorithm-pattern/issues/29/
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

勘误-算法快速入门-示例 2:subsets #29

Open
lufflotneckar opened this issue Aug 4, 2020 · 1 comment
Open

勘误-算法快速入门-示例 2:subsets #29

lufflotneckar opened this issue Aug 4, 2020 · 1 comment

Comments

@lufflotneckar
Copy link

@lufflotneckar lufflotneckar commented Aug 4, 2020

算法写错了,

  • 首先subsets()中调用backtrack()的次数少了.这是出错的根本原因;
  • 另外,backtrack()里面没有写退出递归的if条件;

导致得出的子集数量比正确答案的少.

@greyireland
Copy link
Owner

@greyireland greyireland commented Aug 6, 2020

算法写错了,

  • 首先subsets()中调用backtrack()的次数少了.这是出错的根本原因;
  • 另外,backtrack()里面没有写退出递归的if条件;

导致得出的子集数量比正确答案的少.

这个是跑过的leetcode的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.