说明
这里给出的两个类是在刷力扣时的链表辅助类:
- ListNode 链表节点类
- ListNodeMgr 链表管理类(输出链表元素)
代码
ListNode
public class ListNode
{
public int val;
public ListNode next;
public ListNode(int val = 0, ListNode next = null)
{
this.val = val;
this.next = next;
}
}
ListNodeMgr
public class ListNodeMgr
{
public static void PrintListNode(ListNode head)
{
ListNode tempNode = head;
while(tempNode != null)
{
Debug.Log(tempNode.val);
tempNode = tempNode.next;
}
}
}