Problem Description:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transa...
分类:
其他好文 时间:
2014-06-05 09:33:52
阅读次数:
342
【题目】
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.
The first integer of each row is greater than the last integer of the previous ...
分类:
其他好文 时间:
2014-06-05 08:28:43
阅读次数:
321
class Solution {public: void merge(int A[], int
m, int B[], int n) { int mi = m + n - 1; int ai = m - 1; int bi = n - 1; ...
分类:
其他好文 时间:
2014-06-03 12:57:28
阅读次数:
217
class Solution {private: static int
compare(const Interval& a, const Interval& b) { return a.start
merge(vector &intervals) { vector...
分类:
其他好文 时间:
2014-06-03 12:32:23
阅读次数:
228
题目:Problem DescriptionGiven a two-dimensional
array of positive and negative integers, a sub-rectangle is any contiguous
sub-array of size 1 x 1 or gr...
分类:
其他好文 时间:
2014-05-31 11:35:43
阅读次数:
271
一、什么 RedisREmoteDIctionaryServer,简称
Redis,是一个类似于Memcached的Key-Value存储系统。相比Memcached,它支持更丰富的数据结构,包括string(字符串)、list(链表)、set(集合)、zset(sorted
set --有序集合)...
分类:
Web程序 时间:
2014-05-31 01:37:58
阅读次数:
390
Problem StatementIn the Republic of Nlogonia
there are N cities. For convenience, the cities are numbered 0 through N-1. For
each two different cities...
分类:
其他好文 时间:
2014-05-31 00:47:40
阅读次数:
364
Software architecture vs codeI presented two
talks last week with the title "Software architecture vs code" - first as the
opening keynote for the ina...
分类:
其他好文 时间:
2014-05-30 20:10:50
阅读次数:
379
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST./** * Definition for binary
tree * struct TreeNode { ...
分类:
其他好文 时间:
2014-05-30 15:10:23
阅读次数:
227
DescriptionAn ascending sorted sequence of
distinct values is one in which some form of a less-than operator is used to
order the elements from smalle...
分类:
其他好文 时间:
2014-05-30 14:31:10
阅读次数:
297