Created
August 17, 2021 00:25
-
-
Save monkrus/d7e88ba3a09503f6fc87d3ec230dbb9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package solution | |
| func Solution (A []int, K int) []int { | |
| if len(A) <= 1 || K == 0 { | |
| return A | |
| } | |
| for i := 0; i < K; i++ { | |
| A = append(A[len(A)-1:], A[:len(A)-1]...) | |
| } | |
| return A | |
| } | |
| func main() { | |
| Solution([]int{3,5,6,7},3) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment