算法
反转链表
public ListNode reverseList(ListNode head) {
ListNode result = null;
ListNode current = head;
while (current != null) {
ListNode nextNode = current.next;//1
current.next = result;//2
result = current;//3
current = nextNode;//4
}
return result;
}滑动窗口算法(Sliding Window Algorithm)
最后更新于
这有帮助吗?