[LeetCode] Convert Sorted Array to Binary Search Tree
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:题意为构建有序数组的二分查找树。比较简单,用递归方法即可,中间的元素作为根节点,前半部分作为左孩子树,右半部分作...
[LeetCode] Binary Tree Zigzag Level Order Traversal
Binary Tree Zigzag Level Order TraversalGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level ...
[LeetCode] Validate Binary Search Tree
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys les...
[LeetCode] Unique Binary Search Trees II
Unique Binary Search Trees IIGiven n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should ret...
[LeetCode] Binary Tree Inorder Traversal
Binary Tree Inorder TraversalGiven a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 &n...
[LeetCode] Partition List
Partition ListGiven a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative...
[LeetCode] Reverse Linked List II
Reverse Linked List IIReverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n&nb...
[LeetCode] Subsets II
Subsets IIGiven a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not conta...
[LeetCode] Gray Code
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print t...
[LeetCode] Valid Anagram
Valid AnagramGiven two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram",...
[LeetCode] Remove Duplicates from Sorted List II
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1-&...
Azure搭建SVN服务器及客户端简介
SVN是版本控制器,自从用了它,我就根本离不开他了。团队工作中,用它能够防止冲突,进行版本控制。个人工作中,利用他也能够带来很多方便。首先弄清楚一点,svn分成服务端和客户端。SVN服务器就相当于apache服务器,客户端就相当于浏览器,客户端不会在乎你是哪个软件/哪个系统(Windows下的TortoiseSVN还是Mac下的Versions)。下面我介绍如何在Azure平台上搭建SVN服务器服...
[LeetCode] Search in Rotated Sorted Array II
Search in Rotated Sorted Array IIFollow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a functi...
[LeetCode] Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Y...
[LeetCode] Word Search
Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizonta...
[LeetCode] Set Matrix Zeroes
Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight f...
[LeetCode] Combinations
CombinationsGiven two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ ...
[LeetCode] Simplify Path
Simplify PathGiven an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", =>...
[LeetCode] Unique Paths II
Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 a...
[LeetCode] Minimum Path Sum
Minimum Path SumGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note:...