Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
457 B
1
Indexable
Never
// Задача 1

int[] numbers = // ...

numbers = numbers.OrderBy(num => num).ToArray();
var uniqueNumbers = new SortedSet<int>(numbers);

for (int i = 0; i < numbers.Length - 1; i++)
{
	if (numbers[i] == numbers[i + 1])
	{
		uniqueNumbers.Remove(numbers[i]);
	}
}
// общая сложность алгоритма: O(n*log(n))

// Задача 2
SELECT id
FROM Employee e1
WHERE salary > (
	SELECT salary
	FROM Employee e2
	WHERE e2.id = e1.chief_id
)