经常会需要前面添加
func main(){
test := []int{1,2,3,4,5}
rlt := []int{}
tmp := []int{}
for _,val := range test {
tmp = []int{val}
rlt = append(tmp,rlt...)
}
fmt.Println("reverse: ",rlt)
}
经常会需要前面添加
func main(){
test := []int{1,2,3,4,5}
rlt := []int{}
tmp := []int{}
for _,val := range test {
tmp = []int{val}
rlt = append(tmp,rlt...)
}
fmt.Println("reverse: ",rlt)
}