MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / comb

Method comb

77-combinations/combinations.cpp:3–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Solution {
2public:
3 void comb(int i,int n , int k, vector<vector<int>> &l,vector<int> &c){
4 if (c.size()==k){
5 l.push_back(c);
6 return;
7 }
8 for (int j=i; j<=n;j++){
9 c.push_back(j);
10 comb(j+1,n,k,l,c);
11 c.pop_back();
12 }
13 }
14 vector<vector<int>> combine(int n, int k) {
15 vector<int> c;
16 vector<vector<int>> l;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected