LeetCode:Odd Even Linked List
3 月,跳不动了?>>> 1、题目名称 Odd Even Linked List(链表内元素按奇偶位置重新排序) 2、题目地址 https://leetcode.com/problems/odd-even-linked-list/ 3、题目内容 英文: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity. Example: Given 1->2->3->4->5->NULL , return 1->3->5->2->4->NULL . 中文: 给出一个链表,将所有奇数位置的节点和偶数位置的节点都归拢到一起,将偶数位置的节点放在所有奇数位置节点的后面。例如,给出链表1->2->3->4->5->NULL,应返回链表1->3->5->2->4->NULL。注意 4、解题方法