博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
90 [LeetCode] Subsets2
阅读量:6998 次
发布时间:2019-06-27

本文共 568 字,大约阅读时间需要 1 分钟。

Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).

Note: The solution set must not contain duplicate subsets.

Example:

Input: [1,2,2]Output:[  [2],  [1],  [1,2,2],  [2,2],  [1,2],  []]

 

class Solution {public:  vector
> subsetsWithDup(vector
&S) { vector
> totalset = {
{}}; sort(S.begin(),S.end()); for(int i=0; i
instance = totalset[k]; for(int j=0; j

 

转载于:https://www.cnblogs.com/250101249-sxy/p/10426881.html

你可能感兴趣的文章