Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
codetility CyclicRotation
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Begin 2nd codetility CyclicRotation for:"); int [] A = {10, 11, 12, 13, 14}; int k = 3; foreach (int x in A) { Console.Write(x + ", "); } Console.WriteLine("\nrotated {0} Times",k); var s = new Solution(); A = s.solution(A, k); foreach (int x in A) { Console.Write(x + ", "); } } } public class Solution { public int[] solution(int[] A, int K) { Console.WriteLine("And the answer is:"); for (int x = 1; x<K+1; x++){ rotate(A); } return A; } public int[] rotate(int[] A) { for (int x = 0; x<A.Length; x++){ var temp = A[x]; A[x] = A[A.Length-1]; A[A.Length-1] = temp; } return A; } } }
run
|
edit
|
history
|
help
0
Interface fully qualified names
Listas JL
4647
Vignere Cipher
IEnumerable<T> generic interface implementation
entero_hacia_string
Bridge Design Patern
pared 1
Selection sort
https://www.usgatmtu.mtu.edu/profile/watch-the-bad-guys-online-streaming/profile