Idea
枚举:
从每个数组的起点开始枚举
AC Code
class Solution {
public:
vector<vector<int>> findContinuousSequence(int target) {
vector<vector<int>> ans;
for(int i = 1;i<target;i++){
vector<int> cur;
cur.emplace_back(i);
int sum = i;
for(int j=i+1;j<target;j++){
sum+=j;
cur.emplace_back(j);
if(sum == target){
ans.emplace_back(cur);
break;
}
else if(sum>target) break;
}
}
return ans;
}
};