I've been trying this problem out as well, and I can't seem to get an Accepted verdict.
I only included nth node as well and printed only n-1 node and got AC.
What do you mean by printed only n-1 node? Shouldn't you print all n nodes?
NVM: I got Accepted. For some odd reason, I had to change this line in my code:
Code: Select all
for (i = 0;i <= N_Var;i++)
for (j = 0;j < M_Var;j++)
// code logic
and
Code: Select all
while (array_size > 0)
{
num = pop();
if (num == N_Var)
continue;
if (flag)
printf (" ");
else
flag = true;
printf ("%d",num);
}
I see that there are some discrepancies, I am pretty sure that making the first change i <= N should not matter as we are only considering from 1 to N-1, but I think that there's something left out in the problem set description. Either that, or there's a mistake in the input.