原创 【Leetcode 206】Reverse Linked List 倒置鏈表

題目: Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linke

原创 【leetcode 142】Linked List Cycle II 單鏈表中的環之二

題目: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cyc

原创 【leetcode 24】Swap Nodes in Pairs 成對交換節點

題目: Given a linked list, swap every two adjacent nodes and return its head. Example: Given 1->2->3->4, you should ret

原创 【leetcode 23】Merge k Sorted Lists 合併k個有序鏈表

題目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input

原创 【Leetcode 160】Intersection of Two Linked Lists 求兩個鏈表的交點

題目: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the fol

原创 【leetcode 86】Partition List 劃分鏈表

題目: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or

原创 【leetcode 21】 Merge Two Sorted Lists 混合插入有序鏈表

題目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the no

原创 【leetcode 141】 Linked List Cycle 單鏈表中的環

題目: Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an i

原创 【Leetcode 92】Reverse Linked List II 倒置鏈表之二

題目: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input:

原创 【leetcode 138】Copy List with Random Pointer 拷貝帶有隨機指針的鏈表

題目: A linked list is given such that each node contains an additional random pointer which could point to any node in

原创 【leetcode 99】Recover Binary Search Tree 復原二叉搜索樹

題目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure

原创 【leetcode 98】Validate Binary Search Tree 驗證二叉搜索樹

題目: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The

原创 【leetcode 101】Symmetric Tree 判斷對稱樹

題目: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this b

原创 【leetcode 102】Binary Tree Level Order Traversal 二叉樹層序遍歷

題目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by leve

原创 【leetcode 103】Binary Tree Zigzag Level Order Traversal 二叉樹的之字形層序遍歷

題目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then r