原创 *[Lintcode]Two Sum 兩數之和
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum
原创 [Lintcode]Minimum Size Subarray Sum 和大於S的最小子數組
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum
原创 **[Lintcode]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 le
原创 ***[Lintcode]Maximum Subarray Difference 最大子數組差
Given an array with integers. Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest. R
原创 [Lintcode]Maximum Subarray II 最大子數組 II
Given an array of integers, find two non-overlapping subarrays which have the largest sum.The number in each subarray s
原创 **[Lintcode]Unique Binary Search Trees II 不同的二叉查找樹 II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. Example Given n = 3,
原创 **[Lintcode]Permutation Sequence 第k個排列
Given n and k, return the k-th permutation sequence. Example For n = 3, all permutations are listed as follows: "12
原创 [Lintcode]Binary Tree Level Order Traversal II 二叉樹的層次遍歷 II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level b
原创 *[Lintcode]Unique Binary Search Trees 不同的二叉查找樹
Given n, how many structurally unique BSTs (binary search trees) that store values 1...n? Example Given n = 3, there
原创 **[Lintcode]Subarray Sum Closest最接近零的子數組和
Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last numbe
原创 **[Lintcode]Trapping Rain Water 接雨水
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water
原创 [Lintcode] Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. Example Given n = 3,
原创 [Lintcode]Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping al
原创 **[Lintcode]Maximal Square 最大正方形
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Examp
原创 *[Lintcode]Wiggle Sort擺動排序
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... Example Giv