2019年3月19日

328. Odd Even Linked List(链表元素按奇偶聚集)

摘要: 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 阅读全文

posted @ 2019-03-19 23:07 shaer 阅读(149) 评论(0) 推荐(0) 编辑

234. Palindrome Linked List(回文链表)

摘要: Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: 题目要求:以 O(1) 的空间复杂度来求解。 切成两半,把后半段反转,然后比较两半是否相等。 时间复杂度:o(n) 空间复杂度:o(1 阅读全文

posted @ 2019-03-19 22:48 shaer 阅读(116) 评论(0) 推荐(0) 编辑

445. Add Two Numbers II(链表求和)

摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文

posted @ 2019-03-19 12:03 shaer 阅读(76) 评论(0) 推荐(0) 编辑

24. Swap Nodes in Pairs(交换链表中的相邻结点)

摘要: Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be ch 阅读全文

posted @ 2019-03-19 11:23 shaer 阅读(101) 评论(0) 推荐(0) 编辑

导航