3 sumzero Problem failing , logic is correct , Pls Help as I know only very basic of vector
Modified Code
i have done the required changes
Your mistakes
- at line no 4 correct is int n=A.size();
- from line no 12 to 14
you are doing wrong
you have to return vector of vector not a single vector
so first make a vector of triplet and then push this vector into v
so correct way to do this is
vector<int>temp;
temp.push_back(A[i]);
temp.push_back(A[j]);
temp.push_back(A[k]);
v.push_back(temp);
j++;
now even after this you output will contains some repeated terms
so to remove repetition put the vector into set and then put again into vector
see the modified code for details
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.