sir can you improve the code from line no 88 to line no 91.
code is running successfully but currently i am using two loops. can you tell me how to solve in one loop.
How to move fast pointer to jumps k without using for loop
your solution is a nice one. even you have used 2 loops, its time complexity is linear, which is best time complexity for this problem.
But you can merge these two loops into a single one(remove for loop):
int count = 0;
while(fast!= NULL)
{
fast = fast->next;
if(count>=k)
slow = slow->next;
count++;
}
thanks