上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 48 下一页
摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2017-10-25 16:10 daniel456 阅读(102) 评论(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 @ 2017-10-25 16:07 daniel456 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. 含义:为一个列表排序,要求空间复杂度为常量 思路:使用归并排序 1 public class Solution { 2 public ListNode sor 阅读全文
posted @ 2017-10-25 16:03 daniel456 阅读(84) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort. 含义:用插入排序来对列表进行排序 思路:可以构建一个临时的链表,然后将待排序的链表的每一个节点插入到临时链表中 // 插入排序 public ListNode insertionSortList(ListNode he 阅读全文
posted @ 2017-10-25 15:50 daniel456 阅读(80) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For 阅读全文
posted @ 2017-10-25 15:49 daniel456 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- 阅读全文
posted @ 2017-10-25 15:39 daniel456 阅读(80) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2 阅读全文
posted @ 2017-10-25 15:37 daniel456 阅读(98) 评论(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 a 阅读全文
posted @ 2017-10-25 15:33 daniel456 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2017-10-25 15:31 daniel456 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2017-10-25 15:26 daniel456 阅读(91) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 48 下一页