原创 Morris Traversal

http://www.cnblogs.com/AnnieKim/archive/2013/06/15/MorrisTraversal.html

原创 淺談構造函數與析構函數的調用順序

http://blog.sina.com.cn/s/blog_4c4d6e740100iq69.html 構造函數     先看看構造函數的調用順序規則,只要我們在平時編程的時候遵守這種約定,任何關於構造函數的調用問題都能解決;構造函數

原创 [Leetcode] - Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substr

原创 [LeetCode] - Reorder List

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 with

原创 選擇愛人的數學方法(經典祕書問題)

http://www.cnblogs.com/TenosDoIt/p/3747946.html

原创 最長遞增子序列 O(NlogN)算法

今天學習了求最長遞增子序列這個題的O(NlogN)的解法。記錄一下大概的思路,要不然過一段時間又該忘了。 基本思路就是維護一個數組,假設爲DP。DP[i]所記錄的是,在原始數組的所有長度爲i+1的單調遞增子序列中,結尾處元素的最小值。同時

原创 系統內存分配

http://www.cnblogs.com/dartagnan/archive/2011/09/11/2173520.html http://www.inf.udec.cl/~leo/teoX.pdf

原创 [Leetcode] - Simplify Path

Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/.

原创 [Leetcode] - Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 這道題第一次見到是在Cracking

原创 兩個subarrray的題目

1. Find if there is a subarray with 0 sum: http://www.geeksforgeeks.org/find-if-there-is-a-subarray-with-0-sum/ 2. FInd

原创 [LeetCode] - Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Give

原创 [LeetCode] - Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping al

原创 [Leetcode] - Minimum Window Substring

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexit

原创 [LeetCode] - Gas Station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with

原创 Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Gi