Answers for "how to initialized a 2d vector"

C++
1

how to initialized a 2d vector

To be used in DP problems:

vector<vector<int>>dp; //global init

dp = vector<vector<int>>(n,vector<int>(m,0)); // local init for test cases
where,
	n, m = dimensions of matrix
Posted by: Guest on August-24-2021
3

initializing 2d vector

vector<vector<int> > vec( n , vector<int> (m, 0));
Posted by: Guest on September-09-2020
5

initialising 2d vector

// Initializing 2D vector "vect" with 
// values 
vector<vector<int> > vect{ { 1, 2, 3 }, 
                           { 4, 5, 6 }, 
                           { 7, 8, 9 } };
Posted by: Guest on May-16-2020
0

initialize 2D vector

vector<vector<int> >    v2(8, vector<int>(5));
Posted by: Guest on June-06-2021

Code answers related to "how to initialized a 2d vector"

Browse Popular Code Answers by Language