It's been a long time since I wrote double pointers, so I forgot. In fact, this doesn't count. I just specify a window and save all the numbers from left to right in the middle. I thought it was done in two. . .
class Solution {
public:
vector<vector<int> > FindContinuousSequence(int sum) {
vector<vector<int> > ans;
int l = 1, r = 2;
int val = 0;
while(l < r) {
int num = (l + r) *(r - l + 1) / 2;
if(num == sum) {
vector<int> tep;
for(int i = l; i <= r; i++) {
tep.push_back(i);
}
ans.push_back(tep);
l++;
}
else if(num > sum) {
l++;
}
else {
r++;
}
}
return ans;
}
};