I am not an expert, but this is what it is for the way I understand it.If for example the size of the array is 4 and k also=4, then by rotating it k times it would have its beginning form. So, it would be like not rotating it. By using %, k is now 0, so it will work. If we didn't use it, we would get a stack overflow error. The same applies for size=4 and k=8. I think you now get my point.
Glad to see you are back.Thank you.
Brilliant!!!
Thanks.
welcome back
aswome man very good and clear explanation
Thanks.
amazing. thanks a lot
Glad to hear.
In python language
1)Why self is used in reverse function?
2) while calling reverse function in rotate function we write self.reverse?
Ye wale nahi sirf acche wale questions October challenge ke!
Why k=k%n??
I think is to avoid unnecessary steps for example, [1,2,3] k=10 is the same as [1,2,3] k=1
really that is also tricky for me I also don't understand this
I am not an expert, but this is what it is for the way I understand it.If for example the size of the array is 4 and k also=4, then by rotating it k times it would have its beginning form. So, it would be like not rotating it. By using %, k is now 0, so it will work. If we didn't use it, we would get a stack overflow error. The same applies for size=4 and k=8. I think you now get my point.
thanks 😀
Welcome 😊