E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
leedcode
[
leedcode
106] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. /** * Definition for a binary tree node. * public class
·
2015-10-21 12:55
binary
[
leedcode
102] Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \
·
2015-10-21 12:54
binary
[
leedcode
104] Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. /** * Definition for a binary tree
·
2015-10-21 12:54
binary
[
leedcode
152] Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has t
·
2015-10-21 12:54
array
[
leedcode
103] Binary Tree Zigzag Level Order Traversal
Given 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 and alternate between). For example:Given b
·
2015-10-21 12:54
binary
[
leedcode
100] Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. /** * Defin
·
2015-10-21 12:53
code
[
leedcode
99] Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) space is pretty straight forward. Could you devise a co
·
2015-10-21 12:53
Binary search
[
leedcode
101] Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But
·
2015-10-21 12:53
code
[
leedcode
96] Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should return all 5 unique BST's shown be
·
2015-10-21 12:51
Binary search
[
leedcode
95] Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3
·
2015-10-21 12:51
Binary search
[
leedcode
98] 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 left subtree of a node contains only nodes with keys less than the node
·
2015-10-21 12:51
Binary search
[
leedcode
97] Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca&quo
·
2015-10-21 12:51
String
[
leedcode
93] Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return ["255.255.11.135", &q
·
2015-10-21 12:49
store
[
leedcode
91] Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, det
·
2015-10-21 12:49
decode
[
leedcode
94] Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Note
·
2015-10-21 12:49
binary
[
leedcode
92] Reverse Linked List II
Reverse 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 = 4, return 
·
2015-10-21 12:49
list
[
leedcode
90] Subsets II
Given 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
·
2015-10-21 12:47
code
[
leedcode
88] Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size that is
·
2015-10-21 12:46
array
[
leedcode
89] Gray Code
The 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 the sequ
·
2015-10-21 12:46
code
[
leedcode
87] Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great":
·
2015-10-21 12:45
String
[
leedcode
80] Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For example,Given sorted array nums = [1,1,1,2,2,3], Your function should return length
·
2015-10-21 12:44
remove
[
leedcode
81] Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given ta
·
2015-10-21 12:44
search
[
leedcode
82] Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2->3->3->4->4->5,
·
2015-10-21 12:44
remove
[
leedcode
83] Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return&
·
2015-10-21 12:44
remove
[
leedcode
79] Word Search
Given 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 horizontally or ve
·
2015-10-21 12:42
search
[
leedcode
78] Subsets
Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets. &nb
·
2015-10-21 12:42
code
[
leedcode
77] Combinations
Given 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: [ [2,4],
·
2015-10-21 12:41
code
[
leedcode
75] Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the i
·
2015-10-21 12:40
color
[
leedcode
74] Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.
·
2015-10-21 12:39
search
[
leedcode
73] Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. public class Solution { public void setZeroes(int[][] matrix) { //题目要求
·
2015-10-21 12:39
Matrix
[
leedcode
76] 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 complexity O(n). For example,S = "ADOBECODEBANC"T = "ABC
·
2015-10-21 12:39
substring
[
leedcode
71] Simplify Path
Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => &quo
·
2015-10-21 12:38
code
[
leedcode
70] Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? public class Solution
·
2015-10-21 12:37
code
[
leedcode
69] Sqrt(x)
Implement int sqrt(int x). Compute and return the square root of x. public class Solution { //本题利用了牛顿迭代法:设r是f(x) = 0的根(x^2-k=f(x)),选取x0作为r初始近似值,过点(x0,f(x0))做曲线y = f(x)的切线L,L的方程为y = f
·
2015-10-21 12:37
code
[
leedcode
67] Add Binary
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". public class Solution { public String a
·
2015-10-21 12:37
binary
[
leedcode
66] Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. public class Solution {
·
2015-10-21 12:36
code
[
leedcode
65] Valid Number
Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false
·
2015-10-21 12:35
number
[
leedcode
64] Minimum Path Sum
Given 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: You can
·
2015-10-21 12:35
code
[
leedcode
60] Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3): &q
·
2015-10-21 12:34
sequence
[
leedcode
59] Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the following matrix: [ [
·
2015-10-21 12:34
Matrix
[
leedcode
61] Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1->2->3->4->5->NULL and k = 2,return&nbs
·
2015-10-21 12:34
list
[
leedcode
63] Unique Paths II
Follow 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 and 0&n
·
2015-10-21 12:34
unique
[
leedcode
54] Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: [ [ 1, 2, 3 ],
·
2015-10-21 12:33
Matrix
[
leedcode
58] Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note:&
·
2015-10-21 12:33
length
[
leedcode
57] Merge Intervals
Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. /** * Definition for an interval. * public
·
2015-10-21 12:33
merge
[
leedcode
53] Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2
·
2015-10-21 12:32
array
[
leedcode
121] Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share o
·
2015-10-21 10:17
code
[
leedcode
120] Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [6
·
2015-10-21 10:16
code
[
leedcode
119] Pascal's Triangle II
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. public class Solution { public List<Integer> getRo
·
2015-10-21 10:16
pascal
[
leedcode
118] Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]
·
2015-10-21 10:15
pascal
上一页
3
4
5
6
7
8
9
10
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他