提交说明:删除了一个空行以优化代码结构,并在Solution类中添加了注释以提高代码可读性。

This commit is contained in:
whaifree 2024-06-01 09:44:41 +08:00
parent ed7b36aa7c
commit af61bc8332

View File

@ -18,7 +18,6 @@ public class LeetCode206 {
listNode.printList(); listNode.printList();
ListNode listNode1 = new Solution().reverseList(listNode); ListNode listNode1 = new Solution().reverseList(listNode);
listNode1.printList(); listNode1.printList();
} }
class Solution { class Solution {
@ -34,7 +33,10 @@ public class LeetCode206 {
ListNode next = after.next; ListNode next = after.next;
after.next = pre; after.next = pre;
ListNode reverse = reverse(after, next); ListNode reverse = reverse(after, next);
return reverse; return reverse;
} }
} }
} }