We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;classSolution{staticstringrotate(introt,int[]arr){stringleft=string.Join(" ",arr.Take(rot).ToArray());stringright=string.Join(" ",arr.Skip(rot).ToArray());returnright+' '+left;}staticvoidMain(String[]args){string[]tokens_n=Console.ReadLine().Split(' ');intn=Convert.ToInt32(tokens_n[0]);intk=Convert.ToInt32(tokens_n[1]);string[]a_temp=Console.ReadLine().Split(' ');int[]a=Array.ConvertAll(a_temp,Int32.Parse);// rotate and return as stringstringresult=Solution.rotate(k,a);// print result Console.WriteLine(result);}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
Did something similar in C#..