回溯+sort函数:

//
// Created by jt on 2020/8/31.
//
#include <vector>
#include <algorithm>
using namespace std;

class Solution {
public:
    vector<vector<int> > subsets(vector<int> &S) {
        vector<vector<int> > res;
        dfs(res, S, 0, vector<int>());
        return res;
    }

    void dfs(vector<vector<int> > &res, vector<int> &S, int idx, vector<int> tmp) {
        if (idx > S.size() - 1) { sort(tmp.rbegin(), tmp.rend()); res.push_back(tmp); return; }
        dfs(res, S, idx+1, tmp);
        tmp.push_back(S[idx]);
        dfs(res, S, idx+1, tmp);
    }
};