Comments (3)
好像对了,这样:
vector<vector<int>> enumerate_all_permutations(int* arr, int arr_len, int count) {
vector<vector<int>> result;
if (count == 1) {
for (int i = 0; i < arr_len; i++) {
vector<int> v;
v.push_back(arr[i]);
result.push_back(v);
}
return result;
}
for (int i = 0; i < arr_len - (count-1); i++) {
int key = arr[i];
vector<vector<int>> v = enumerate_all_permutations(arr+i+1, arr_len-i-1, count-1);
for (int j = 0; j < v.size(); j++) {
v[j].push_back(key);
result.push_back(v[j]);
}
}
return result;
}
from 15-year-old-konjac-wants-to-learn-oi.
我操啊,到底怎么链接 commit
啊……
from 15-year-old-konjac-wants-to-learn-oi.
Resolved: fc43181 in resolved/algorithms_implementation/Enumerate_All_Permutations.cpp
(就这样吧)
from 15-year-old-konjac-wants-to-learn-oi.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 15-year-old-konjac-wants-to-learn-oi.