Whats wrong with my code?
adj is vector of vectors
if you write adj[i].push_back()
this will give you error because adj[i] is not define
it should be a vector but not define
you have to declare 2Dvector like this
vector<vector<int>> adj(n,vector<int>(m));
then after that you can also write
cin>>adj[i][j];
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.