I cannot optimize my code. The constraints are very large. I cannot think of any other way other than recursion for merging arrays. please help me out to resolve TLE
Merge 2 sorted Linked List - showingTLE
hi vaari
your merge function is not correct you don’t have to modify your head
instead you should merge the two linked lists into another 3rd linked list and then print the 3rd merged linked list.
recall the procedure for merging two arrays where we used to take an auxiliary array and store the merged array over there.
do the same for linked list as well.
if you still don’t understand do let me know so that we can discuss the correct code
Hey @AASTHA011 I made some changes in my code as per your instructions. you can go through my code.
But i am still getting TLE. I don’t know why
can you please share your code where you have made changes
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.