
链表
文章平均质量分 70
chuandalishuo
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
2.Add Two Numbers
python code: class Solution(object): def addTwoNumbers(self, l1, l2): len1=0 len2=0 p=l1 while p != None : p=p.next len1=len1+1 p=l原创 2015-12-18 23:55:49 · 475 阅读 · 0 评论 -
287. Find the Duplicate Number
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number,原创 2016-11-01 01:18:37 · 173 阅读 · 0 评论 -
203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 --> 5 /** * Definition for si原创 2016-10-20 07:27:44 · 195 阅读 · 0 评论 -
160. Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘原创 2016-09-28 13:01:19 · 159 阅读 · 0 评论 -
206. Reverse Linked List
Reverse a singly linked list. /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solu原创 2016-10-21 15:35:17 · 142 阅读 · 0 评论 -
25. Reverse Nodes in k-Group[hard]
题目: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain a原创 2016-06-03 00:58:59 · 231 阅读 · 0 评论 -
24. Swap Nodes in Pairs [easy]
题目: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant s原创 2016-05-17 00:45:56 · 272 阅读 · 0 评论 -
23.Merge k Sorted Lists
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Java /** * Definition for singly-linked list. * public class ListNode { * int val;原创 2016-05-17 00:26:08 · 335 阅读 · 0 评论 -
21. Merge Two Sorted Lists
题目 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. Java /** * Definition for singly-linked list. *原创 2016-04-30 00:46:41 · 193 阅读 · 0 评论 -
19. Remove Nth Node From End of List
题目: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the原创 2016-04-28 01:19:42 · 204 阅读 · 0 评论 -
146. LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if原创 2016-12-09 14:04:33 · 249 阅读 · 0 评论