Skip to content

Commit

Permalink
Revert " update array_sum_combinations and readme"
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit167 authored Feb 4, 2018
1 parent 2facd0f commit 8edbd35
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Minimal and clean example implementations of data structures and algorithms in P
- [backtrack](backtrack)
- [general_solution.md](backtrack/)
- [anagram](backtrack/anagram.py)
- [array_sum_combinations](backtrack/array_sum_combinations.py)
- [array_sum_combinations](backtrack/array_sum_combination.py)
- [combination_sum](backtrack/combination_sum.py)
- [expression_add_operators](backtrack/expression_add_operators.py)
- [factor_combinations](backtrack/factor_combinations.py)
Expand Down
4 changes: 1 addition & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ python版数据结构和算法实现的简约版小示例
- [backtrack:回溯](backtrack)
- [general_solution.md:一般方法](backtrack/)
- [anagram:同字母异序词](backtrack/anagram.py)
- [array_sum_combinations:数组和](backtrack/array_sum_combinations.py)
- [array_sum_combinations:数组和](backtrack/array_sum_combination.py)
- [combination_sum:和的合并](backtrack/combination_sum.py)
- [expression_add_operators:给表达式添加运算符](backtrack/expression_add_operators.py)
- [factor_combinations:因素组合](backtrack/factor_combinations.py)
Expand Down Expand Up @@ -212,5 +212,3 @@ python版数据结构和算法实现的简约版小示例
- [union-find:并查集](union-find)
- [count_islands:岛计数](union-find/count_islands.py)

[或者可以用不同语言来完成上述算法,期待加入](https://github.com/yunshuipiao/sw-algorithms)

6 changes: 3 additions & 3 deletions backtrack/factor_combinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def getFactors(self, n):
n, i, combi = todo.pop()
while i * i <= n:
if n % i == 0:
combis.append(combi + [i, n/i]),
todo.append(n/i, i, combi+[i]),
combis += combi + [i, n/i],
todo += (n/i, i, combi+[i]),
i += 1
return combis

Expand All @@ -53,7 +53,7 @@ def getFactors(self, n):
def factor(n, i, combi, combis):
while i * i <= n:
if n % i == 0:
combis.append(combi + [i, n/i]),
combis += combi + [i, n/i],
factor(n/i, i, combi+[i], combis)
i += 1
return combis
Expand Down

0 comments on commit 8edbd35

Please sign in to comment.