Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
findrotations
//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 FindRotations(int [] arr) { int pos = 0; int rot = 0; for(int i=0;i<arr.Length;i++) { if(arr[i+1]<arr[i]) { pos = i+1; break; } } rot = arr.Length - pos; Console.WriteLine(rot); } public static void Main(string[] args) { int [] arr = new int [] {4,5, 1,2,3}; FindRotations(arr); } } }
run
|
edit
|
history
|
help
0
Full join
7.2 Creating async methods the old way
Random number generator
FindElementInAscendingSortedRotatedArray
Regex fórum 01
Checking time span between two timezone times
Time by 15 minutes
Swap w/o third var
Towers of Hanoi
Intuit // C# // listing_4.8 (while)