MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/recursion/sum_of_subset.cpp:54–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54int main(int argc, char const *argv[])
55{
56 vector<int> candidates;
57 // {5, 10, 12, 13, 15, 18}
58 int n;
59 int target;
60 cout << "Enter the number of candidates: ";
61 cin >> n;
62 cout<<"Enter the target: ";
63 cin >> target;
64 cout << "Enter the candidates: ";
65 for(int i=0;i<n;i++)
66 {
67 int candidate;
68 cin >> candidate;
69 candidates.push_back(candidate);
70 }
71 combinationSum(candidates, target);
72
73
74 return 0;
75}
76
77// Time Complexity :
78// O((2^n)*k*logn)

Callers

nothing calls this directly

Calls 2

combinationSumFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected