Skip to content

Instantly share code, notes, and snippets.

@monkrus
Created August 17, 2021 00:25
Show Gist options
  • Select an option

  • Save monkrus/d7e88ba3a09503f6fc87d3ec230dbb9e to your computer and use it in GitHub Desktop.

Select an option

Save monkrus/d7e88ba3a09503f6fc87d3ec230dbb9e to your computer and use it in GitHub Desktop.
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