[LeetCode-Easy] Rotate Array

Using Golang To Solve This Problem.

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