add some new examples

This commit is contained in:
2022-09-16 01:40:14 +04:00
parent 6e5b860955
commit 3683bdf7c2
5 changed files with 13 additions and 36 deletions

12
rotation/rotation.go Normal file
View File

@@ -0,0 +1,12 @@
package rotation
func Rotation(A []int, K int) []int {
for i := 0; i < K; i++ {
//A[len(A)-1: - последний элемент; A[:len(A)-1] - все элементы до последнего
A = append(A[len(A)-1:], A[:len(A)-1]...)
}
return A
}