Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
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
Please
log in
to post a comment.
Explicit Interface Implementation
UriParts
sss
Fórum Multiple Tests Returning Error Message
uzyskanie daty poniedziaĆku
Hello world
memes
ref and out
4647
Fixing Broken Lines with Regex
stackse - search stackoverflow differently
Please log in to post a comment.