Kreverse problem

It shows a warning and then does not compile.

hi @srshubhi398 there are logical errors with your buildlist() function

int buildlist(node *&head)
{
	int N,K;
	cin>>N>>K;
	int data;
	while(N--)
	{
        cin>>data; //take input before you insert it in list
		insertion(head,data);
	}
    return K; //return K, you forgot to return value this is why compilation error was was coming
	
}

Now the code gets compiled.but no testcase is giving the correct answer.

@srshubhi398 see the sample output…code is not giving correct output there are some logical errors think about it

Thanks a lot.I shall try.

1 Like