[LeetCode-Easy] Rotate Array

Golang

func rotate(nums []int, k int)  {
    k %= len(nums)
    
    for i := 0; i < k; i++ {
        p := nums[len(nums) - 1]
        for k, _ := range nums {
            nums[k], p = p, nums[k]
        }
    }
}

Javascript

// TODO