public void reverse(head){
ListNode current, prev, next;
current = head;
prev = null;
while(current!=null){
next = current.next;
current.next = prev;
prev = current;
current = next;
}
head = prev;
return head;
}
公式测试
最新推荐文章于 2024-02-08 13:41:26 发布