Untitled
unknown
plain_text
2 years ago
560 B
5
Indexable
static List<string> FindUniqueElements(string[] arr) { HashSet<string> allElements = new HashSet<string>(); HashSet<string> uniqueElements = new HashSet<string>(); foreach (string word in arr) { if (allElements.Contains(word)) { uniqueElements.Remove(word); } else { allElements.Add(word); uniqueElements.Add(word); } } return new List<string>(uniqueElements);
Editor is loading...