From b824619dd919fd31fb3c475c66aa6177a925d0a3 Mon Sep 17 00:00:00 2001 From: Divlo Date: Sat, 11 Sep 2021 19:00:56 +0200 Subject: [PATCH] feat(solutions): add `sorting-algorithms/cs/function` --- .../solutions/cs/function/README.md | 3 ++ .../solutions/cs/function/Solution.cs | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 challenges/sorting-algorithms/solutions/cs/function/README.md create mode 100644 challenges/sorting-algorithms/solutions/cs/function/Solution.cs diff --git a/challenges/sorting-algorithms/solutions/cs/function/README.md b/challenges/sorting-algorithms/solutions/cs/function/README.md new file mode 100644 index 0000000..40899e6 --- /dev/null +++ b/challenges/sorting-algorithms/solutions/cs/function/README.md @@ -0,0 +1,3 @@ +# sorting-algorithms/cs/function + +Created by [@Divlo](https://github.com/Divlo) on 11 September 2021. diff --git a/challenges/sorting-algorithms/solutions/cs/function/Solution.cs b/challenges/sorting-algorithms/solutions/cs/function/Solution.cs new file mode 100644 index 0000000..df7ce74 --- /dev/null +++ b/challenges/sorting-algorithms/solutions/cs/function/Solution.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace Solution +{ + class Program + { + static void Main() + { + string line = Console.ReadLine(); + List numbers = new List(); + while ((line = Console.ReadLine()) != null) + { + numbers.Add(int.Parse(line)); + } + int[] result = NativeSort(numbers.ToArray()); + foreach (int number in result) + { + Console.WriteLine(number); + } + } + + public static int[] NativeSort(int[] array) + { + Array.Sort(array); + return array; + } + } +}