Skip to content

Commit

Permalink
Update 40.combination-sum-ii.md
Browse files Browse the repository at this point in the history
  • Loading branch information
azl397985856 authored Jun 20, 2020
1 parent cb7ff8d commit d04f9b0
Showing 1 changed file with 1 addition and 52 deletions.
53 changes: 1 addition & 52 deletions problems/40.combination-sum-ii.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ A solution set is:

我们先来看下通用解法的解题思路,我画了一张图:

![backtrack](../assets/problems/backtrack.png)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)

通用写法的具体代码见下方代码区。

Expand All @@ -62,57 +62,6 @@ A solution set is:
* 语言支持: Javascript,Python3

```js
/*
* @lc app=leetcode id=40 lang=javascript
*
* [40] Combination Sum II
*
* https://leetcode.com/problems/combination-sum-ii/description/
*
* algorithms
* Medium (40.31%)
* Total Accepted: 212.8K
* Total Submissions: 519K
* Testcase Example: '[10,1,2,7,6,1,5]\n8'
*
* Given a collection of candidate numbers (candidates) and a target number
* (target), find all unique combinations in candidates where the candidate
* numbers sums to target.
*
* Each number in candidates may only be used once in the combination.
*
* Note:
*
*
* All numbers (including target) will be positive integers.
* The solution set must not contain duplicate combinations.
*
*
* Example 1:
*
*
* Input: candidates = [10,1,2,7,6,1,5], target = 8,
* A solution set is:
* [
* ⁠ [1, 7],
* ⁠ [1, 2, 5],
* ⁠ [2, 6],
* ⁠ [1, 1, 6]
* ]
*
*
* Example 2:
*
*
* Input: candidates = [2,5,2,1,2], target = 5,
* A solution set is:
* [
* [1,2,2],
* [5]
* ]
*
*
*/
function backtrack(list, tempList, nums, remain, start) {
if (remain < 0) return;
else if (remain === 0) return list.push([...tempList]);
Expand Down

0 comments on commit d04f9b0

Please sign in to comment.