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.
This one in C# asks to create to whole class but it fails... Am I getting negatives cuz of performance?
classSolution{staticvoidMain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */intqueries=Convert.ToInt32(Console.ReadLine());intarrLength=Convert.ToInt32(Console.ReadLine());string[]arrStr=Console.ReadLine().Split(' ');int[]arr=newint[arrLength];int[]res=newint[arrLength];for(intcount=0;count<arrStr.Length;count++){intitem=Convert.ToInt32(arrStr[count]);arr[count]=item;}arr=arr.OrderBy(x=>x).ToArray();for(intindex=0;index<arrLength;index++){res[index]=arr[index<(arrLength-1)/2?index:(arrLength-index)+2];}Console.WriteLine(String.Join(" ",res).Trim());}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Zig Zag Sequence
You are viewing a single comment's thread. Return to all comments →
This one in C# asks to create to whole class but it fails... Am I getting negatives cuz of performance?