不会跑

work for life

01 Jun 2017

LeetCode–reverse_linked_list_II

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...
28 May 2017

LeetCode–Remove-Linked-List-Elements

Remove all elements from a linked list of integers that have value val. Example Given: 1 –> 2 –> 6 –> 3 –> 4...
28 May 2017

LeetCode–Palindrome-Linked-List

Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? # _...
28 May 2017

LeetCode–odd-even-linked-list

最近主要练习链表的变换,这个题很经典,特别是容易忽略末尾出现的闭环 Given a singly linked list, group all odd nodes together followed by the even nodes. P...
28 May 2017

LeetCode–reverse-nodes-in-k-group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive intege...
22 May 2017

LeetCode–MergeKList

# _*_ coding: utf-8 _*_ ''' Merge k sorted linked lists and return it as one sorted list. Analyze and descri...
21 May 2017

LeetCode–链表排序O(nlogn)

# _*_ coding: utf-8 _*_ ''' Sort a linked list in O(n log n) time using constant space complexity. ''...
19 May 2017

LeetCode–统计更小值数量

Time: O(nlogn) Space: O(n) You are given an integer array nums and you have to return a new counts array. The counts arr...
18 May 2017

LeetCode--实现字典树

class TrieNode(object): def __init__(self): self.is_word = False # 某个节点是否为单词,一般默认为path(路径) # 当有单词录入时,变为True self.leaves ...
18 May 2017

算法--按层打印二叉树

# _*_ coding: utf-8 _*_ # 按层打印二叉树 class TreeNode(object): def __init__(self, val): self.val = val self.left = None self....