Merge k sorted array

i am getting segmentation fault through my code
can you tell me my mistake
here is my code

@aditikandhway i guess you can’t take 2D vector array input like simple 2d array.
try this way to take input

for(int i=0;i<n;i++)
{
    vector<int> v1;
	for(int j=0;j<m;j++)
	{
        int ele;
		 cin>>ele;
         v1.push_back(ele);
	}
    arr.push_back(v1);
}

yes you were right now my doubt has been resolved. thank you!!

1 Like