I have a list with the elements [1,2,3,4,5]
.
If I have another list that contains elements of the mainlist such as [1,2]
or [2,4,5]
, what's an efficient way to generate new lists with the missing numbers, so that:
[1, 2]
utilizing [1,2,3,4,5]
would give [3, 4 ,5]
[2, 4, 5]
utilizing [1,2,3,4,5]
would give [1, 3]
I was thinking of using a nested for-loop to check, but I was wondering if there's a more efficient way or built-in function that can be used in C#.