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
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
initializing 2d vector
vector<vector<int> > vec( n , vector<int> (m, 0));
initialising 2d vector
// Initializing 2D vector "vect" with
// values
vector<vector<int> > vect{ { 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 } };
initialize 2D vector
vector<vector<int> > v2(8, vector<int>(5));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us