Skip to content

Instantly share code, notes, and snippets.

@MichaelaIvanova
Created July 12, 2017 09:09
Show Gist options
  • Save MichaelaIvanova/4db4e49e8550f00c7c20273453564ee0 to your computer and use it in GitHub Desktop.
Save MichaelaIvanova/4db4e49e8550f00c7c20273453564ee0 to your computer and use it in GitHub Desktop.
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