Problem Description
A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most impor...
分类:
其他好文 时间:
2014-10-09 16:32:58
阅读次数:
176
Search in Rotated Sorted Array
Total Accepted: 27955 Total
Submissions: 97929My Submissions
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 ...
分类:
其他好文 时间:
2014-10-09 16:29:38
阅读次数:
177
[leetcode]Given two numbers represented as strings, return multiplication of the numbers as a string....
分类:
其他好文 时间:
2014-10-09 16:02:38
阅读次数:
174
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...
分类:
其他好文 时间:
2014-10-09 15:58:28
阅读次数:
232
The key is to use two constant space(32 bits) to store how many times 1 or 0 showed up in the bit i. If times of 1 in bit i is not the multiple of 3, then the unique value's bit i is 1. Otherwise the ...
分类:
其他好文 时间:
2014-10-09 15:29:08
阅读次数:
243
题目链接地址:http://soj.me/1176题目大意:两头取数。第一个人随机取,第二个人用贪婪算法(每次都取大的),求两人取数在第一个人赢的情况下的最大分差。使用贪婪算法时,如果左右两边相等,取左边的。核心算法:动态规划。 设数组arr[a][b]是在数列区间[a,b]上的最大分差。 递推公式...
分类:
其他好文 时间:
2014-10-09 14:57:33
阅读次数:
159
1.normal fetch ----fetch 1 cache line once2. pre-fetch mode one ---- fetch 3 cache line once3.pre-fetch mode two ----{way1: fetch 3 cache lines once ,...
分类:
其他好文 时间:
2014-10-09 14:41:14
阅读次数:
196
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). How do you find an elemen...
分类:
其他好文 时间:
2014-10-09 14:22:13
阅读次数:
332
Find the intersection of two sorted arrays.Let’s called array1 as A and array2 as B, each with size m and n.The obvious brute-force solution is to sca...
分类:
其他好文 时间:
2014-10-09 14:20:13
阅读次数:
161
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:
其他好文 时间:
2014-10-09 13:16:43
阅读次数:
179