Rotate Array | LeetCode 189 | C++, Java, Python

Поділитися
Вставка
  • Опубліковано 9 січ 2025

КОМЕНТАРІ • 16

  • @KamleshSharma-si2rq
    @KamleshSharma-si2rq 4 роки тому +1

    Glad to see you are back.Thank you.

  • @surya.maheshkolisetty1997
    @surya.maheshkolisetty1997 Рік тому +2

    Brilliant!!!

  • @crankyinmv
    @crankyinmv 4 роки тому +3

    welcome back

  • @sanskargupta2739
    @sanskargupta2739 3 роки тому +2

    aswome man very good and clear explanation

  • @all-rounderchannel835
    @all-rounderchannel835 2 роки тому +1

    amazing. thanks a lot

  • @unknowncorner7359
    @unknowncorner7359 2 роки тому

    In python language
    1)Why self is used in reverse function?
    2) while calling reverse function in rotate function we write self.reverse?

  • @acxd
    @acxd 4 роки тому

    Ye wale nahi sirf acche wale questions October challenge ke!

  • @mohammedwaseem8599
    @mohammedwaseem8599 3 роки тому +4

    Why k=k%n??

    • @dazoo1847
      @dazoo1847 2 роки тому +1

      I think is to avoid unnecessary steps for example, [1,2,3] k=10 is the same as [1,2,3] k=1

    • @abdulhannan288
      @abdulhannan288 Рік тому

      really that is also tricky for me I also don't understand this

    • @stevebestgames5460
      @stevebestgames5460 9 місяців тому

      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.

  • @annesyabanerjee1892
    @annesyabanerjee1892 4 роки тому +1

    thanks 😀