摘要: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文
posted @ 2019-09-06 09:53 蓝天下的一棵草 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2019-09-05 09:03 蓝天下的一棵草 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list 阅读全文
posted @ 2019-09-02 11:20 蓝天下的一棵草 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up:Could you do it in O(n) time and O(1) space? 一开始不理解回文是什么意 阅读全文
posted @ 2019-09-01 10:27 蓝天下的一棵草 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 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-08-30 09:22 蓝天下的一棵草 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val. Example: 说到删除,首先想到定义两个指针,分别指向要被删除的结点和该结点的前驱结点。这里还需要考虑头结点是需要删除结点的特殊情况。 阅读全文
posted @ 2019-08-29 14:58 蓝天下的一棵草 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 思路: 重塑链表, 阅读全文
posted @ 2019-08-29 14:48 蓝天下的一棵草 阅读(207) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove the n-th node from the end of list and return its head. Example: Note: Given n will always be valid. Follow up: Could you 阅读全文
posted @ 2019-07-27 16:03 蓝天下的一棵草 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2019-07-27 15:59 蓝天下的一棵草 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use 阅读全文
posted @ 2019-07-25 09:02 蓝天下的一棵草 阅读(142) 评论(0) 推荐(0) 编辑