My code is only passing 2 test cases and is failing the rest of them. Please help.
K append problem
k can also be greater than n. So do one simple thing - update k to k%n
And then create a function pushes the last element to the front. Call this function k times and display the final linked list.
What to do if n=k ?.Should I return the very same linked list?
Yes right. k%n will be zero in that case.
And you can try it on paper as well. You will get the same linked list.
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.