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 7fdb7b1

Browse files
committed
Update0090.子集2,添加C#
1 parent 5b5a05a commit 7fdb7b1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎problems/0090.子集II.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,31 @@ object Solution {
640640
}
641641
}
642642
```
643+
### C#
644+
```c#
645+
public class Solution
646+
{
647+
public IList<IList<int>> res = new List<IList<int>>();
648+
public IList<int> path = new List<int>();
649+
public IList<IList<int>> SubsetsWithDup(int[] nums)
650+
{
651+
Array.Sort(nums);
652+
BackTracking(nums, 0);
653+
return res;
654+
}
655+
public void BackTracking(int[] nums, int start)
656+
{
657+
res.Add(new List<int>(path));
658+
for (int i = start; i < nums.Length; i++)
659+
{
660+
if (i > start && nums[i] == nums[i - 1]) continue;
661+
path.Add(nums[i]);
662+
BackTracking(nums, i + 1);
663+
path.RemoveAt(path.Count - 1);
664+
}
665+
}
666+
}
667+
```
643668

644669
<p align="center">
645670
<a href="https://programmercarl.com/other/kstar.html" target="_blank">

0 commit comments

Comments
(0)

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