/*RMQ(Range Minimum/Maximum Query)问题: RMQ问题是求给定区间中的最值问题。当然,最简单的算法是O(n)的,但是对于查询次数很多(设置多大100万次),O(n)的算法效率不够。可以用线段树将算法优化到O(logn)(在线段树中保存线段的最值)。不过,Spars.....
分类:
编程语言 时间:
2015-06-18 18:49:08
阅读次数:
120
Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the second soldier. Then
the second one tries to make maximum possible number of rounds. ...
分类:
其他好文 时间:
2015-06-18 17:20:26
阅读次数:
116
题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet...
分类:
编程语言 时间:
2015-06-18 11:07:33
阅读次数:
151
求任意两个数的gcd最大值。
#include
#include
#include
#include
#include
#include
#include
#define N 110
using namespace std;
int n;
int s[N];
int gcd(int b,int a) {
return b==0?a:gcd(a%b,b);
}
int main() ...
分类:
其他好文 时间:
2015-06-18 09:42:27
阅读次数:
100
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-06-17 15:16:35
阅读次数:
140
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2015-06-17 11:13:53
阅读次数:
133
GoldenGate过程 abend,报错OGG-00868 ORA-02396: Exceeded Maximum Idle Time, Please Connect Again参考原始:GoldenGate Processes Abend with OGG-00868 ORA-02396: Ex...
分类:
其他好文 时间:
2015-06-17 11:03:55
阅读次数:
151
problem:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one uniqu...
分类:
其他好文 时间:
2015-06-16 18:32:29
阅读次数:
113
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 k transactions.
Note:
You may no...
分类:
其他好文 时间:
2015-06-16 16:51:37
阅读次数:
107
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.强行解:inline bool valueSame(double a, double b) { re...
分类:
其他好文 时间:
2015-06-16 12:27:10
阅读次数:
86