How to Solve Error: runtime error: reference binding to null pointer of type ‘std::vector<int, std::allocator<int>>‘
For vector<vector >
When initializing it, you have to open up the appropriate storage space for it!
Solution:
when initializing, open up the required storage space:
//Suppose the size of the two-dimensional array space is m x n
vector<vector<int> > count(m);
for(int i=0;i<m;i++)
count[i].resize(n);