fork download
using System;
using System.Collections.Generic;
using System.Linq;

public class Test
{

	public static void Main()
	{
        var list1 = new List() { 1, 2, 3, 4 };
        var list2 = new List() { 2, 3, 5, 6, 7, 8 };
        var list3 = new List() { 3, 4, 5 };
        var all = new List>() { list1, list2, list3 };

        int min = all.Min(l => l.Min());
        var max = all.Max(l => l.Max());
        int count = max - min + 1;
        
        List l1Result = new List(count);
        List l2Result = new List(count);
        List l3Result = new List(count);
        
        foreach (int val in Enumerable.Range(min, count))
        {
            if (list1.BinarySearch(val) >= 0)
                l1Result.Add(val);
            else
                l1Result.Add(new Nullable());
        
            if (list2.BinarySearch(val) >= 0)
                l2Result.Add(val);
            else
                l2Result.Add(new Nullable());
        
            if (list3.BinarySearch(val) >= 0)
                l3Result.Add(val);
            else
                l3Result.Add(new Nullable());
        }
        
        Console.WriteLine(string.Join(",", l1Result.Select(i => !i.HasValue ? "NULL" : i.Value.ToString()).ToArray()));
        Console.WriteLine(string.Join(",", l2Result.Select(i => !i.HasValue ? "NULL" : i.Value.ToString()).ToArray()));
        Console.WriteLine(string.Join(",", l3Result.Select(i => !i.HasValue ? "NULL" : i.Value.ToString()).ToArray()));
	}
}
Success #stdin #stdout 0.05s 38256KB
stdin
Standard input is empty
stdout
1,2,3,4,NULL,NULL,NULL,NULL
NULL,2,3,NULL,5,6,7,8
NULL,NULL,3,4,5,NULL,NULL,NULL