摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2018-02-14 23:21 于淼 阅读(71) 评论(0) 推荐(0) 编辑
摘要: Given a list, rotate the list to the right by k places, where k is non-negative. Example: Tips:右移结点,过程如下: k=2,右移两次: ①5->1->2->3->4 ②4->5->1->2->3 思路:( 阅读全文
posted @ 2018-02-14 16:13 于淼 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2018-02-14 00:36 于淼 阅读(107) 评论(0) 推荐(0) 编辑