diff --git a/LeetCode/src/main/java/com/code/leet/study/t20210210/ReorderList.java b/LeetCode/src/main/java/com/code/leet/study/t20210210/ReorderList.java new file mode 100644 index 0000000..e1c3998 --- /dev/null +++ b/LeetCode/src/main/java/com/code/leet/study/t20210210/ReorderList.java @@ -0,0 +1,45 @@ +package com.code.leet.study.t20210210; + +import com.code.leet.entiy.ListNode; + +import java.util.ArrayList; +import java.util.List; + +/** + * 给定一个单链表 L:L0→L1→…→Ln-1→Ln , + * 将其重新排列后变为: L0→Ln→L1→Ln-1→L2→Ln-2→… + *
+ * 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
+ */
+public class ReorderList {
+ /**
+ * 143. 重排链表
+ */
+ public void reorderList(ListNode head) {
+ if (head == null) {
+ return;
+ }
+ List