Beispiel #1
0
        static Solution.ListNode CreateListNode(List <int> L)
        {
            Solution.ListNode res = new Solution.ListNode(0);
            var cur = res;

            foreach (int i in L)
            {
                cur = cur.next = new Solution.ListNode(i);
            }
            return(res.next);
        }
Beispiel #2
0
        static string ListNode2String(Solution.ListNode L)
        {
            string s = "(";

            while (L != null)
            {
                s += L.val.ToString() + "->";
                L  = L.next;
            }
            return(s.Substring(0, s.Length - 2) + ')');
        }