class Solution {
public:
vector<vector<int>> fileCombination(int target) {
vector<vector<int>> v;
int l = 1;
int r = 2;
int s = 3;
while(l < r)
{
if(s==target)
{
vector<int> v1;
for(int k = l;k <= r;k++)
{
v1.push_back(k);
}
v.push_back(v1);
}
if(s >= target)
{
s -= l;
l++;
}
else
{
r++;
s += r;
}
}
return v;
}
};
leetcode每日一题第六十四天
最新推荐文章于 2024-10-31 16:16:13 发布