
链表
码不停Ti
信息安全在校大学生
展开
-
【LeetCode】141. Linked List Cycle[快慢指针]
Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed)in the linked list where tail co...原创 2019-12-10 11:23:49 · 352 阅读 · 0 评论 -
【LeetCode】23. Merge k Sorted Lists 分治
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[1->4->5,1->3->4,2->6]Output: 1->1->2->3->4-&...原创 2019-12-09 20:41:51 · 342 阅读 · 0 评论 -
【Leet Code】206. Reverse Linked List
Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be reversed either iteratively or recursivel...原创 2019-10-04 19:35:40 · 322 阅读 · 0 评论 -
【LeetCode】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.Example:Input: 1->2->4, 1->3->4Output: 1-&...原创 2019-10-03 14:42:28 · 315 阅读 · 0 评论 -
【Leet Code】19. Remove Nth Node From End of List
19. Remove Nth Node From End of ListGiven a linked list, remove then-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After re...原创 2019-10-02 23:41:56 · 322 阅读 · 0 评论 -
【LeetCode】2. Add Two Numbers
题目描述You are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two numbers and...原创 2019-09-26 13:21:25 · 360 阅读 · 0 评论