public override void Run()
        {
            var a   = new int[] { 1, 3, 5 };
            var b   = new int[] { 2 };
            var ret = MergeTwoLists(ListNode.Parse(a), ListNode.Parse(b));

            Console.WriteLine(ret);
            Console.ReadKey();
        }
Beispiel #2
0
        public void ReverseKGroup_Solutions(string listString, int k, string expected)
        {
            ListNode head = ListNode.Parse(listString);

            var solution = new ReverseKGroupClass();
            var result   = solution.ReverseKGroup(head, k);

            Assert.AreEqual(expected, result.ToString(","));
        }
Beispiel #3
0
        public override void Run()
        {
            var a   = new int[] { 1, 2 };
            var ret = ReverseKGroup(ListNode.Parse(a), 2);

            while (ret != null)
            {
                Console.WriteLine(ret.val);
                ret = ret.next;
            }
            Console.ReadKey();
        }
Beispiel #4
0
        public override void Run()
        {
            var a = new int[] { 1, 3, 5 };
            var b = new int[] { 2 };
            var c = new int[] { 4 };

            List <ListNode> list = new List <ListNode>();

            list.Add(ListNode.Parse(a));
            list.Add(ListNode.Parse(b));
            list.Add(ListNode.Parse(c));
            var ret = MergeKLists(list.ToArray());

            Console.WriteLine(ret);
            Console.ReadKey();
        }