原创 [LeetCode] Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5
原创 [LeetCode] Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2
原创 [LeetCode] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. /** * Definition for binary tree * struct
原创 [LeetCode] Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time com
原创 [LeetCode] Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flippin
原创 [LeetCode] Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected g
原创 [LeetCode] Populating Next Right Pointers in Each Node II
Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tr
原创 [LeetCode] Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'.
原创 [LeetCode] Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for
原创 頻繁連接斷開mysql出現的問題
今天寫的程序需要頻繁執行連接斷開mysql這一操作,而且時間間隔又很短,於是乎出現了下面這個問題 The driver was unable to create a connection due to an inability to e
原创 [LeetCode] Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its correspondi
原创 [LeetCode] Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkN
原创 [LeetCode] 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: Giv
原创 JDK中的URLConnection參數詳解
針對JDK中的URLConnection連接Servlet的問題,網上有雖然有所涉及,但是隻是說明了某一個或幾個問題,是以FAQ的方式來解決的,而且比較零散,現在對這個類的使用就本人在項目中的使用經驗做如下總結: 1:> URL請求的類
原创 [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree. /** * Definition for binary tree * struct