the following code is giving time limit exceeded
link-https://ide.codingblocks.com/s/122905
Time limit exceeded problem in merge sorted linked list problem
Hello @rishu7865,
If you observe the execution of your code for the test cases like:
2
4
1 3 5 7
5
2 4 6 7 9
4
1 3 5 7
3
2 4 6
where the value of t>1.
Before taking input for the sorted linked lists, you are required to make a and b point to NULL.
But, you are doing this only for the first iteration.
Thus, causing TLE.
To understand this better, run your code on the above-mentioned test case.
I modified your code:
Hope, this would help.
Give a like, if you are satisfied.