Beispiel #1
0
        static void Main(string[] args)
        {
            var firstUnique = new FirstUnique(new int[] { 2, 3, 5 });

            Console.WriteLine(firstUnique.ShowFirstUnique());
            firstUnique.Add(5);
            Console.WriteLine(firstUnique.ShowFirstUnique());
            firstUnique.Add(2);
            Console.WriteLine(firstUnique.ShowFirstUnique());
            firstUnique.Add(3);
            Console.WriteLine(firstUnique.ShowFirstUnique());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            FirstUnique firstUnique = new FirstUnique(new int[] { 2, 3, 5 });

            Console.WriteLine(firstUnique.ShowFirstUnique()); // return 2
            firstUnique.Add(5);                               // the queue is now [2,3,5,5]
            Console.WriteLine(firstUnique.ShowFirstUnique()); // return 2
            firstUnique.Add(2);                               // the queue is now [2,3,5,5,2]
            Console.WriteLine(firstUnique.ShowFirstUnique()); // return 3
            firstUnique.Add(3);                               // the queue is now [2,3,5,5,2,3]
            Console.WriteLine(firstUnique.ShowFirstUnique()); // return -1

            Console.ReadKey();
        }