Help me out in this problem


my code on leetcode

question link

@aman212yadav my code is giving run time error

@shivammishra20121999

image

u cannot use indexing on empty vector v.

first declare it of size m.size and the it will not give run error

@aman212yadav
still it is giving same error

@aman212yadav bro leave it ho gaya ek error tha

first ki jaah second aur second ki jagah first tha…

baaki thoda v vector mein bhi change tha

@aman212yadav no to initialise we have to create n+1 size vector
baaki same hi code haan
first ki jagaah second nahi hoga

what if i say ,it is wrong

i have made a one change
vector<vector> v(n+1,vector g);
only everything is same
@aman212yadav

yeah this one is correct

@aman212yadav thks for the help