Created
April 29, 2024 08:01
-
-
Save trayforyou/e71560112671f1a13ea17b859d82f19d 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; | |
using System.ComponentModel; | |
using System.Xml.Linq; | |
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>(); | |
SortNumbers1(numbers1,ref sortingNumbers); | |
SortNumbers1(numbers2,ref sortingNumbers); | |
} | |
private static void SortNumbers1(string[] numbers,ref List<string> sortingNumbers) | |
{ | |
for (int i = 0; i <numbers.Length; i++) | |
{ | |
if (sortingNumbers.Contains(numbers[i])) | |
{ | |
continue; | |
} | |
else | |
{ | |
sortingNumbers.Add(numbers[i]); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment