I'll teach you how to pass vectors to functions efficiently. If you pass by value like void func(vector v), C++ copies the entire vector which is slow for large data. Pass by const reference with void func(const vector& v) to avoid copying while preventing modifications.
If the function needs to change the vector, use a non-const reference void func(vector& v). To return a vector from a function, just return it normally - C++ optimizes this with move semantics so it doesn't copy.
Never return a pointer or reference to a local vector because it dies when the function ends.