# 解法一(快慢指针 + 反转 + 合并)

## 方法一代码

``````/**
* public class ListNode {
*     int val;
*     ListNode next;
*     ListNode() {}
*     ListNode(int val) { this.val = val; }
*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
// 无返回值
return;
}
// 得到中间节点

// 分割链表
ListNode l2 = mid.next;
mid.next = null;

// 下部分链表 反转
l2 = myReverse(l2);

// 上下两部分链表合并
}
public static void mergeLinked(ListNode l1,ListNode l2){
ListNode l1_tmp = null;// 用来记录 l1 的 next
ListNode l2_tmp = null;// 用来记录 l2 的 next

while(l1!=null && l2 != null){
l1_tmp = l1.next;
l2_tmp = l2.next;

l1.next = l2;
l1 = l1_tmp;

l2.next = l1;
l2 = l2_tmp;
}
}

ListNode prev = null;
while(cur!=null){
ListNode curNext = cur.next;
cur.next = prev;
prev = cur;
cur = curNext;
}
return prev;
}

while(fast!=null && fast.next!=null){
fast = fast.next.next;
slow =slow.next;
}
return slow;
}
}
``````

# 解法二 （借助线性表）

## 代码

``````/**
* public class ListNode {
*     int val;
*     ListNode next;
*     ListNode() {}
*     ListNode(int val) { this.val = val; }
*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
return;
}
List<ListNode> list = new ArrayList<>();

while(node!=null){
node = node.next;
}

int n = list.size();
int j  = n -1;
int i = 0;
while(i < j){
list.get(i).next = list.get(j);
i++;
if(i == j){
break;
}

list.get(j).next = list.get(i);
j--;
}
list.get(i).next = null;
}
}
``````

THE END

)">