problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::permutations_ii::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static void dfs (set< vector< int > > &s, const vector< int > &current, vector< int > rest)
 
static vector< vector< int > > permuteUnique (vector< int > &nums)
 

详细描述

在文件 leetcode.h2399 行定义.

成员函数说明

◆ dfs()

void leetcode::permutations_ii::Solution::dfs ( set< vector< int > > &  s,
const vector< int > &  current,
vector< int >  rest 
)
static

在文件 leetcode.cpp6446 行定义.

6446 {
6447 if(rest.empty()) {
6448 s.insert(current);
6449 return;
6450 }
6451 for(auto it = rest.begin(); it != rest.end(); ++it) {
6452 vector<int> next_current = current;
6453 vector<int> next_rest = rest;
6454 next_current.push_back(*it);
6455 next_rest.erase(next_rest.begin() + (it - rest.begin()));
6456 dfs(s, next_current, next_rest);
6457 }
6458 }
static void dfs(set< vector< int > > &s, const vector< int > &current, vector< int > rest)
Definition: leetcode.cpp:6446

引用了 dfs().

被这些函数引用 dfs() , 以及 permuteUnique().

◆ permuteUnique()

vector< vector< int > > leetcode::permutations_ii::Solution::permuteUnique ( vector< int > &  nums)
static

在文件 leetcode.cpp6435 行定义.

6435 {
6436 vector<vector<int>> ans;
6437 set<vector<int>> s;
6438 dfs(s, vector<int>(), nums);
6439 ans.reserve(s.size());
6440 for(const auto &vec: s) {
6441 ans.emplace_back(vec);
6442 }
6443 return ans;
6444 }
int vec[100010]
Definition: pat.cpp:5095

引用了 dfs() , 以及 pat::a::a7_2::vec.


该类的文档由以下文件生成: