Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro...
分类:
其他好文 时间:
2015-01-08 09:43:18
阅读次数:
169
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 ...
分类:
其他好文 时间:
2015-01-08 00:44:50
阅读次数:
274
原题如下;
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
题意很简单:根据中序遍历和后序遍历的序列生成树
思路很简单:根据后序遍历的序列确定根节点,在中序遍历中找到根节点,将原来的序列分为左右两个部分,递归解决左右两个部分就可以解决这个问题。
Java代码如下:
publ...
分类:
其他好文 时间:
2015-01-07 01:52:25
阅读次数:
160
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-01-06 23:07:00
阅读次数:
208
Given an array of sizen, find the majority element. The majority element is the element that appears more than? n/2 ?times.You may assume that the arr...
分类:
其他好文 时间:
2015-01-06 22:55:36
阅读次数:
206
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal...
分类:
其他好文 时间:
2015-01-06 15:28:32
阅读次数:
131
题目描述:
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
解题思路:先序遍历的第一个元素为根元素,在中序遍历序列中找到根元素的位置。中...
分类:
其他好文 时间:
2015-01-06 11:58:44
阅读次数:
159
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Defini...
分类:
其他好文 时间:
2015-01-06 07:09:29
阅读次数:
207
【题目】
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elem...
分类:
其他好文 时间:
2015-01-05 22:01:41
阅读次数:
238
DATAS SEGMENT STRING DB ? DATAS ENDS CODES SEGMENT ASSUME CS:CODES,DS:DATAS START: MOV AX,DAT...
分类:
其他好文 时间:
2015-01-05 14:28:04
阅读次数:
117