@lakshit hey do k=k%n ,it will pass.
I have done this only at line number 86
@lakshit null wala and single node wala case bhi dekh lena.