Ejemplo n.º 1
0
        public void Test3()
        {
            Intersect.ListNode first1 = this.MakeList(new int[] { 1 });
            Intersect.ListNode first2 = this.MakeList(new int[] { 5, 2, 3, 11, 15 });

            Assert.AreEqual(-1, Intersect.Solve(first1, first2));
        }
Ejemplo n.º 2
0
        public void Test1()
        {
            Intersect.ListNode first1 = this.MakeList(new int[] { 1, 3, 7, 10 });
            Intersect.ListNode first2 = this.MakeList(new int[] { 5, 4, 3, 2 });

            Assert.AreEqual(-1, Intersect.Solve(first1, first2));
        }
Ejemplo n.º 3
0
        public void Test7()
        {
            Intersect.ListNode first      = this.MakeList(new int[] { 5, 2, 3, 11, 15 });
            Intersect.ListNode crossFirst = this.MakeList(new int[] { 11, 23, 43 });
            this.MergeLists(first, crossFirst);

            Assert.AreEqual(5, Intersect.Solve(first, crossFirst));
            Assert.AreEqual(0, Intersect.Solve(crossFirst, first));
        }
Ejemplo n.º 4
0
        public void Test6()
        {
            Intersect.ListNode first1     = this.MakeList(new int[] { 1 });
            Intersect.ListNode first2     = this.MakeList(new int[] { 5, 2, 3, 11, 15 });
            Intersect.ListNode crossFirst = this.MakeList(new int[] { 11, 23, 43 });
            this.MergeLists(first1, crossFirst);
            this.MergeLists(first2, crossFirst);

            Assert.AreEqual(1, Intersect.Solve(first1, first2));
        }
Ejemplo n.º 5
0
        public void Test4()
        {
            Intersect.ListNode first1     = this.MakeList(new int[] { 1, 3, 7, 10 });
            Intersect.ListNode first2     = this.MakeList(new int[] { 5, 4, 3, 2 });
            Intersect.ListNode crossFirst = this.MakeList(new int[] { 11, 23, 43 });
            this.MergeLists(first1, crossFirst);
            this.MergeLists(first2, crossFirst);

            Assert.AreEqual(4, Intersect.Solve(first1, first2));
        }