Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5b5a05a

Browse files
committed
Update0078.子集,添加C#
1 parent 5f485a0 commit 5b5a05a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎problems/0078.子集.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,27 @@ object Solution {
443443
}
444444
}
445445
```
446+
### C#
447+
```csharp
448+
public class Solution {
449+
public IList<IList<int>> res = new List<IList<int>>();
450+
public IList<int> path = new List<int>();
451+
public IList<IList<int>> Subsets(int[] nums) {
452+
BackTracking(nums, 0);
453+
return res;
454+
}
455+
public void BackTracking(int[] nums, int start){
456+
res.Add(new List<int>(path));
457+
if(start > nums.Length) return;
458+
for (int i = start; i < nums.Length; i++)
459+
{
460+
path.Add(nums[i]);
461+
BackTracking(nums, i + 1);
462+
path.RemoveAt(path.Count - 1);
463+
}
464+
}
465+
}
466+
```
446467

447468

448469
<p align="center">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /