I am facing timelimit for this code

this is the ide for my code,could you please correct me.

hey @Shwetatrisal, your input as well as output sequence is not correct. You doing it for multiple testcases but there is only one testcase here. Moreover you need to input n than m than n elements and m elements but you are doing it like first n then n elements then m then m elements.

Also output is space separated not comma separated.
Updated code https://ide.codingblocks.com/s/108871

Hii sir. The input sample says
1 - no. of test cases
4 - no. of elements
1 3 5 7 - elements
3 -no. of elements
2 4 6 - elements

hey @Shwetatrisal, sorry for this, might be there are two copies of same question. I will debug it for correct question and share you upadated code with changes within 5 minutes.

hey @Shwetatrisal, for multiple testcases you need to have different LL but you have declared node* a,a1 outside the while loop. So that nodes of new testcase gets added to previous testcase LL. So you have to put declare these pointers as null inside the while loop. Moreover output format should be comma separated code.
Updated Code https://ide.codingblocks.com/s/108891

Thankyou sir for correcting me.

hey @Shwetatrisal , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

I have already done sir.

1 Like