I have a question regarding reusing of vectors / arrays in certain tasks which are posted with number of queries before.
For example, the following task on hackerrank: Breadth First Search: Shortest Reach
Starts with the number of queries that will be inputed, and then each query is task for itself.
Now, I would like to reuse the 'visited' array which I'll create, along with 'neighbours' 2d vector which I'll create, but I am not sure how to do it effectively.
Most problems on google code jam also have the same structure, so question is more general than just this BFS question..
Examples are more than welcome, thanks :)