Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
给出树的中序和先序遍历 要求返回树 中序结果{1,2,5,4,3,6} 先序{4,2,1,5,3,6}根据先...
分类:
其他好文 时间:
2014-12-30 15:22:45
阅读次数:
176
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
还是重构树 与上一题相比 先序换成了后序 思路还是一样 代码如下:
public class S...
分类:
其他好文 时间:
2014-12-30 15:22:19
阅读次数:
153
Given an array of size n, find the majority element. The majority element is the element that appears more than ?
n/2 ? times.
You may assume that the array is non-empty and the majority element ...
分类:
其他好文 时间:
2014-12-30 10:04:31
阅读次数:
206
题目:
Given an array of size n, find the majority element. The majority element is the element that appears more than ? n/2 ? times.
You may assume that the array is non-empty and the majority eleme...
分类:
其他好文 时间:
2014-12-29 21:30:26
阅读次数:
192
题目:
Compare two version numbers version1 and version1.
If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.
You may assume that the version strings are non-emp...
分类:
编程语言 时间:
2014-12-29 12:11:35
阅读次数:
320
Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there...
分类:
其他好文 时间:
2014-12-28 23:38:24
阅读次数:
271
1 assume cs:code 2 3 data segment 4 db 9,8,7,4,2,0 5 db 0,3,6,9,12,15 6 data ends 7 8 stack segment 9 dw 16 dup (0)10 stack...
分类:
编程语言 时间:
2014-12-28 23:37:13
阅读次数:
328
问题描述:
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character
'.'.
You may assume that there will be only one unique solution.
A sud...
分类:
其他好文 时间:
2014-12-28 11:42:52
阅读次数:
360
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
这个题目的解法与LeetCode[Tree]: Construct Binary Tree from Pre...
分类:
其他好文 时间:
2014-12-28 09:15:15
阅读次数:
165
Longest Palindromic Substring-- HARD 级别Question SolutionGiven a string S, find the longest palindromic substring in S. You may assume that the maximum...
分类:
其他好文 时间:
2014-12-27 20:12:16
阅读次数:
136