go int array move position code example
Example: go int array move position
//go int array move given position
//Input
//1
//5 2
//1 2 3 4 5
//Output
//4 5 1 2 3
package main
import "fmt"
func main(){
var t,i,j,k,n,x uint32=0,0,0,0,0,0
fmt.Scan(&t)
for i=0;i<t;i++{
n,k=0,0
fmt.Scan(&n,&k)
a:=make([]uint32,n)
for i=0;i<n;i++{fmt.Scanf("%v",&a[i])}
for i=0;i<k;i++{
x=a[n-1]
for j=n-1;j>0;j--{a[j]=a[j-1]}
a[0]=x
}
for i=0;i<n;i++{fmt.Printf("%v ",a[i])}
}
}