how do you go through a 2d vector in O(n) time? code example
Example: initialzing a 2d vector in cpp
// Create a vector containing n row and m columns
vector<vector<int> > vec( n , vector<int> (m, 0));
// Create a vector containing n row and m columns
vector<vector<int> > vec( n , vector<int> (m, 0));