2023年7月20日
摘要: class Solution { public ListNode reverseList(ListNode head) { if (head == null || head.next == null) { return head; } ListNode preNode = null; ListNod 阅读全文
posted @ 2023-07-20 17:16 Hi,Bro 阅读(4) 评论(0) 推荐(0) 编辑
摘要: //快慢指针public class Solution { public boolean hasCycle(ListNode head) { if (head == null || head.next == null) { return false; } ListNode fastNode = he 阅读全文
posted @ 2023-07-20 16:32 Hi,Bro 阅读(2) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if (headA == null || headB == null) { return null; } Lis 阅读全文
posted @ 2023-07-20 16:15 Hi,Bro 阅读(2) 评论(0) 推荐(0) 编辑
摘要: //将一个链表插入到另一个链表中class Solution { public ListNode mergeTwoLists(ListNode list1, ListNode list2) { if (list1 == null) { return list2; } if (list2 == nul 阅读全文
posted @ 2023-07-20 15:26 Hi,Bro 阅读(14) 评论(0) 推荐(0) 编辑