Advertisement
bobomarinov

Untitled

Jan 30th, 2020
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. class BestTravel
  2. {
  3. public:
  4.     static int chooseBestSum(int t, int k, std::vector<int>& ls){
  5.     std::cout << "size: " << ls.size() << '\n';
  6.    
  7.     int combinations = factorial(ls.size())/(factorial(ls.size()-k)*factorial(k));
  8.     std::cout << "combinations: " << combinations << '\n';
  9.     int sum[combinations];
  10.     int return_value;
  11.  
  12.    
  13.     return return_value;
  14.     };
  15.    
  16.     static int factorial(int n)
  17.       {
  18.           // single line to find factorial
  19.           return (n==1 || n==0) ? 1: n * factorial(n - 1);  
  20.       }
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement