Created
July 12, 2017 09:09
-
-
Save MichaelaIvanova/4db4e49e8550f00c7c20273453564ee0 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
static void Main(string[] args) | |
{ | |
int[] input = new int[] {3, 8, 9, 7, 6}; | |
int k = 3; | |
solution(input, k); | |
} | |
public static int[] solution(int[] input, int times) | |
{ | |
var r = new int[input.Length]; | |
for (int i = 0; i < input.Length; i++) | |
{ | |
var index = (i + times)%input.Length; | |
r[index] = input[i]; | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment