Пример #1
0
        public void TestReverseListNodeWithIndex_OutOfBoundary()
        {
            // 5 => 4 => 3 => 2 => 1
            var a = new ListNode(1, null);
            var b = new ListNode(2, a);
            var c = new ListNode(3, b);
            var d = new ListNode(4, c);
            var e = new ListNode(5, d);

            var result = ListNodeMethod.PrintListNode(ListNodeMethod.ReverseListNodeWithIndex(e, 3, 8));

            Assert.AreEqual("54123", result);
        }
Пример #2
0
        public void TestReverseListNodeWithIndex_SameStartAndEnd()
        {
            // 5 => 4 => 3 => 2 => 1
            var a = new ListNode(1, null);
            var b = new ListNode(2, a);
            var c = new ListNode(3, b);
            var d = new ListNode(4, c);
            var e = new ListNode(5, d);

            var result = ListNodeMethod.PrintListNode(ListNodeMethod.ReverseListNodeWithIndex(e, 3, 3));

            Assert.AreEqual("54321", result);
        }