2019年3月18日

19. Remove Nth Node From End of List(删除链表中的第n个结点)

摘要: 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. 方法一:双指针 删除倒数第n个点,我们首先 阅读全文

posted @ 2019-03-18 23:23 shaer 阅读(119) 评论(0) 推荐(0) 编辑

83. Remove Duplicates from Sorted List(从有序链表中删除重复节点)

摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 方法二:直接前向传播 递归是从后往 前找,这个用while循环从前从后找。 阅读全文

posted @ 2019-03-18 22:55 shaer 阅读(108) 评论(0) 推荐(0) 编辑

160. Intersection of Two Linked Lists(找出两个链表的交点) &&两个链表的第一个公共结点(剑指offer)

摘要: 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-03-18 12:16 shaer 阅读(99) 评论(0) 推荐(0) 编辑

279. Perfect Squares(完美平方数)

摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Example 2: 时间复杂 阅读全文

posted @ 2019-03-18 11:52 shaer 阅读(637) 评论(0) 推荐(0) 编辑

导航