- 博客(6)
- 收藏
- 关注
原创 【LEETCODE】86- Partition List [Python]
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of
2016-02-26 10:46:04 2037
原创 【LEETCODE】82- Remove Duplicates from Sorted List II [Python]
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->3->3->4->4->5, return 1->2->5. Given 1->1-
2016-02-25 19:25:30 1205
原创 【LEETCODE】143- Reorder List [Python]
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 example, Given {1,2,3,4}, reorder it to {1,
2016-02-24 16:05:42 1166
原创 【LEETCODE】61- Rotate List [Python]
Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. 题意: 给一个list,向右轮换k个位置,k非负
2016-02-24 12:24:49 1408
原创 【LEETCODE】148- Sort List [Python]
Sort a linked list in O(n log n) time using constant space complexity. 题意: 对一个链表排序,O(n log n) time , constant space complexity 思路: 根据题意对时间和空间复杂度的要求,此处排序用归并 参考: 归并排序: http://blog.csd
2016-02-23 17:35:56 1915
原创 【LEETCODE】328- Odd Even Linked List [Python]
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 value in the nodes. You should try to do it in p
2016-02-23 11:37:21 1715
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人