Vectors of vectors stl

suppose i need to search for duplicate set of numbers in a matrix of vector given by

“vector < vector < int > > sols”

and i want to find a duplicate set in this matrix. I tried using

" auto it = std::find (sols.begin(), sols.end(), {1,2,3}); "

can someone guide me better regarding this.

auto it = std::find (sols.begin(), sols.end(), {1,2,3});
this means you are searching for a vector {1,2,3} in sols.
sols = { {…} ,{…} , {…} }

suppose i need to search for duplicate set of numbers in a matrix of vector given by

can you please elaborate

i am doing something like target sum triplet question, where i need to find all unique triplets in the array which gives the sum of zero.
I am using vector to store my result in sol in this format
[[-1,-1,2],[-1,0,1],[-1,0,1]]
my target number here being 0.
but this gives me a duplicate set [-1,0,1]
so my subtask is basically to eliminate this duplicate.

you can use set<vector> ;
push all the vectors in set.

1 Like

yaa it would work thanks.

1 Like

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.