You are viewing a single comment's thread. Return to all comments →
with C#: Output as expected but somwehow not passing not even the first test case.
Error
Traceback (most recent call last): File "Solution.py", line 178, in <module> run_custom_checker(t_obj, r_obj) File "Solution.py", line 77, in run_custom_checker system_code = code_data[t_obj.submission_language].strip() KeyError: u'csharp'Traceback (most recent call last): File "Solution.py", line 178, in <module> run_custom_checker(t_obj, r_obj) File "Solution.py", line 77, in run_custom_checker system_code = code_data[t_obj.submission_language].strip() KeyError: u'csharp'
**C# code **
using System; using System.Collections.Generic; using System.IO; class Solution { private static List<int> findZigZagSequence(List<int> ar) { List<int> zigZagedList = ar.ToList(); zigZagedList.Sort(); zigZagedList[ar.Count / 2] = (from n in ar select n).Max(); zigZagedList[ar.Count - 1] = ar[ar.Count / 2]; int startIndex = (ar.Count / 2) + 1; int endIndex = ar.Count - startIndex; List<int> decreasingList = zigZagedList.GetRange(startIndex, endIndex); decreasingList.Sort((a, b) => b.CompareTo(a)); zigZagedList.RemoveRange(startIndex, endIndex); zigZagedList.AddRange(decreasingList); return zigZagedList; } static void Main(String[] args) { int t = Convert.ToInt32(Console.ReadLine().Trim()); for (int i = 0; i < t; i++) { int n = Convert.ToInt32(Console.ReadLine().Trim()); List<int> ar = Console.ReadLine().TrimEnd().Split(' ').ToList().Select(arTemp => Convert.ToInt32(arTemp)).ToList(); Console.WriteLine(String.Join(' ', findZigZagSequence(ar))); } } } }
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 →
with C#: Output as expected but somwehow not passing not even the first test case.
Error
**C# code **