原创 leetcode標記數組

1、Valid Sudoku 鏈接:https://leetcode.com/problems/valid-sudoku/ 思路:一次遍歷行、列、小格子;標記數組 public boolean isValidSudoku(ch

原创 Leetcode 鏈表

1、Linked List Cycle 鏈接:https://leetcode.com/problems/linked-list-cycle/ 思路:fast、slow兩個指針,fast走兩步,slow走一步,若有環,fast

原创 leetcode 樹遍歷變種

1、Sum Root to Leaf Numbers 鏈接:https://leetcode.com/problems/sum-root-to-leaf-numbers/ 思路:遞歸,改層的和 = 上層和* 10 +當前val

原创 Manacher馬拉車算法總結

http://blog.csdn.net/dyx404514/article/details/42061017 附java代碼 private static String preProcess(String s){

原创 nginx + tomcat應用分佈式

nginx的作用: 內容服務器(反向代理):以代理服務器來接受Internet上的連接請求,然後將請求轉發給內部網絡上的服務器;並將從服務器上得到的結果返回給Internet上請求連接的客戶端,此時代理服務器對外就表現爲一個內容服

原创 LeetCode 貪心

1、題目:Jump Game 鏈接:https://leetcode.com/problems/jump-game/ 思路:dp[i]:當前i位置可以到達的最遠距離;從nums後面開始遍歷,一次縮小問題規模 publi

原创 leetcode圖

leetcode圖的相關題目解析: 對圖的遍歷就是兩個經典的方法DFS和BFS。BFS經常用Queue實現,DFS經常用遞歸實現(可改爲棧實現)。 1、Clone Graph 題意:給定圖中一個節點,克隆圖 思路:用Hash

原创 leetcode數組(一)

1、Remove Element 鏈接:https://leetcode.com/problems/remove-element/ 思路:將i,j分別指向頭尾,nums[i] == val 且nums[j] != val, 用

原创 leetcode 鏈表 排序

1、Sort List 鏈接:https://leetcode.com/problems/sort-list/ 思路:使用歸併排序。拆分、合併均採用遞歸方式。 public ListNode sortList(List

原创 leetcode 重建二叉樹

1、Construct Binary Tree from Preorder and Inorder Traversal 鏈接:https://leetcode.com/problems/construct-binary-tree

原创 Leetcode 樹的遍歷

1、Same Tree 鏈接:https://leetcode.com/problems/same-tree/ 思路:遞歸思想 public boolean isSameTree(TreeNode p, TreeNod

原创 kernel+PITF

Kernel+PITF 未補充

原创 leetcode數組遍歷技巧

1、Container With Most Water 鏈接:https://leetcode.com/problems/container-with-most-water/ 思路:從數組頭尾向中間移動。取較小的那邊移動,因爲

原创 leetcode 字符串問題(一)

1、Count and Say 鏈接:https://leetcode.com/problems/count-and-say/ 思路:注意一點,java中String類型改變耗時長,使用StringBuffer來代替Strin

原创 leetcode二分排序 & 查找:

2、Search for a Range 鏈接:http://oj.leetcode.com/problems/search-for-a-range/ 思路:二分法查找 public int[] searchRange(int[