Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jordancalder/dc4082a0b25820ef709b65c2e3d52a06 to your computer and use it in GitHub Desktop.
Save jordancalder/dc4082a0b25820ef709b65c2e3d52a06 to your computer and use it in GitHub Desktop.
package solution
func Solution(A []int, K int) []int {
if len(A) < 2 || K == 0 { return A }
if K > len(A) { K = K % len(A) }
x, a := A[len(A)-K:len(A)], A[:len(A)-K]
return append(x, a...)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment