Don't get the idea of rotate


  • 0
    C

    how comes {1,2,3,4,5} k=2 => {4,5,1,2,3}

    while {1,2} k=0 expects {1,2}?

    what exactly does this rotate means?

    if {1,2} k=0 => {1,2} then:

    {1,2,3,4,5} k=0 => {1,2,3,4,5}

    {1,2,3,4,5} k=1 => {2,3,4,5,1}

    {1,2,3,4,5} k=2 => {3,4,5,1,2}

    which violates the given example

    jesus!!


  • 4
    S

    I believe we should rotate it in below way, not the opposite one.

    Here is the sample:

    if {1,2} k=0 => {1,2} then:

    {1,2,3,4,5} k=0 => {1,2,3,4,5}

    {1,2,3,4,5} k=1 => {5, 1, 2,3,4}

    {1,2,3,4,5} k=2 => {4, 5, 1,2, 3}

    {1,2,3,4,5} k=3 => {3, 4, 5, 1,2}


  • 0
    R

    I think this rotating way is very weird.


  • 0
    R

    what if {1,2,3,4,5} k=10?
    {1,2}k=2, why should be {2,1}??
    I think it should be still {1,2}


  • 0
    B
    This post is deleted!

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.