# 2.1.3.一串數列中任取n個數字, 總共有幾種組合

*   example code

    ```
            class Solution {
             public:
              vector<vector<int>> subsets(vector<int>& nums) {
                  vector<int> record;
                  vector<vector<int>> res;

                  for (int i = 0; i < nums.size(); i++){
                      helper(res, nums, record, i + 1 , 0);
              }
                  //加入空list
                  vector<int > temp ;
                  res.push_back(temp);
                  return res;
              }
              void helper(vector<vector<int>>& res, vector<int>&nums, vector<int>&record, int num, int start_point){
                  //終止條件: 剩餘數量=0
                  if (num == 0){
                      res.push_back(record);
                      return;
                  }
                  for (int i = start_point; i < nums.size(); i++){
                      record.push_back(nums[i]);
                      helper(res, nums,record, num - 1, i + 1);
                      record.pop_back();
                  }
              }
        };
    ```
