hi,
You have used STL conatiners so i suggest instead of using a 2d array either use an std::map container Or store a std::pair in the vector.
An intro to Std::map[
^]
putting pairs in std::vector[
^]
some suggestions :
1. give meaningful names to variables. Avoid int i, int k etc.
2.Better use of STL : the work of finding the unique element in the vector can be done by using the STL find or find_if functions.
for example :
std::find(vector.begin(), vector.end(), item)!=vector.end()
so you do not have to write a separate function and save yourself a function call.
3).Iterators are the preferred method of traversing through STL containers.
how iterators are used[
^]
3). you can use new feature of automatic type deduction (keyword 'auto') or range based for loop (you can google for these).
hope this helps !!