Created
April 29, 2024 05:05
-
-
Save trayforyou/a1f48119f69c0290eb0675d176791257 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace Collections4 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string[] numbers1 = { "1", "2", "1" }; | |
string[] numbers2 = { "3", "2" }; | |
List<string> sortingNumbers = new List<string>(); | |
sortingNumbers.AddRange(numbers1); | |
sortingNumbers.AddRange(numbers2); | |
Console.WriteLine(); | |
SortNumbers(sortingNumbers); | |
Console.ReadKey(); | |
} | |
private static void SortNumbers(List<string> sortingNumbers) | |
{ | |
Retry: | |
for (int i = 0; i < sortingNumbers.Count; i++) | |
{ | |
for (int j = i + 1; j < sortingNumbers.Count; j++) | |
{ | |
if (sortingNumbers[i] == sortingNumbers[j]) | |
{ | |
sortingNumbers.RemoveAt(j); | |
goto Retry; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment