예제 #1
0
        public int[] TestSolution(int[] l1, int[] l2)
        {
            ListNode node1 = new ListNode(l1);
            ListNode node2 = new ListNode(l2);

            return(MergeTwoSortedLists.Solution(node1, node2).ToArray());
        }
예제 #2
0
        public void MergeTwoSortedListsTests()
        {
            var l1     = new ListNode(1, new ListNode(2, new ListNode(4)));
            var l2     = new ListNode(1, new ListNode(3, new ListNode(4)));
            var result = new ListNode(1,
                                      new ListNode(1, new ListNode(2, new ListNode(3, new ListNode(4, new ListNode(4))))));
            var solver = new MergeTwoSortedLists();
            var res    = solver.Solution(l1, l2);

            Assert.AreEqual(res, result);
        }