摘要: public class MergeTwoSortedLists { /* 解法一:迭代 */ public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if (l1==null) return l2; if (l2==null) ... 阅读全文
posted @ 2019-09-03 20:59 张玉昊 阅读(281) 评论(0) 推荐(0) 编辑
摘要: public class IntersectionOfTwoLinkedList { /* 解法一:暴力遍历求交点。 时间复杂度:O(m*n) 空间复杂度:O(1) */ public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if(headA==null||headB==null) return null; if 阅读全文
posted @ 2019-09-03 13:30 张玉昊 阅读(234) 评论(0) 推荐(0) 编辑