实现单链表的逆转函数,输入一个链表,反转链表后,返回翻转之后的链表。
加载中...
/* 只需要完成逆置链表函数 public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ public class Solution { public ListNode ReverseList(ListNode head) { } }
/* 只需要完成逆置链表函数 struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ class Solution { public: ListNode* ReverseList(ListNode* pHead) { } };