Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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
 
PREVIOUS NEXT
Tagged: #initialized #vector
ADD COMMENT
Topic
Name
6+1 =