class Solution
{
public:
vector> combine(int n, int k)
{
vector vecTmp;
m_vecRet.clear();
combination(1, n, vecTmp, k);
return m_vecRet;
}
private:
void combination(int from, int to, vector &curr, int k)
{
if (k == 0)
{
m_vecRet.push_back(curr);
}
else if (from > to)
{
return;
}
else
{
curr.push_back(from);
combination(from + 1, to, curr, k - 1);
curr.pop_back();
combination(from + 1, to, curr, k);
}
}
private:
vector> m_vecRet;
};