Doubt doubt doubt

https://ide.codingblocks.com/s/587073 --> why is it printing the same linked list ???

image
here eventually ur n value became 0 after while loop and n = 0 was being sent to yr newList function… this was just the mistake…

I have corrected ur code.

https://ide.codingblocks.com/s/587084 --> any hint ?? this code is not clearing all the test cases.

https://ide.codingblocks.com/s/587084 --> any hint ?? this code is not clearing all the test cases.

image
make this change in ur code… it will pass all tests

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.

K=K%N; --> agar k > n, i.e: n=8, k=10…then hum sirf last two elements ko aage leke jaana chahte h…isliye ye line add kari aapne ???

yes… parth… i hope ur doubt is cleared now

but mujhe ye pata kese chalega…question me mention to nahi h esa kuch…??

so first u append it n times… still k is not zero so u append it more k-n times… so in total it is k%n

its similar to rotating array k times to the left/right

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.