摘要:
求最大公约数哪个强,果断GCD,非递归版本和递归版本如下:#includeusing namespace std;int gcd(int a, int b){ //非递归版本 int big = max(a, b); int small = min(a, b); int tem... 阅读全文
摘要:
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
摘要:
求两个后缀数组的最长公共前缀,可以转化为求某个区间上的最小值。 接下来,先来构造后缀数组,先看这里。 //求两个后缀的最长公共前缀 int lcs(int i, int j){ int b, e; if(RANK[i] > RANK[j]) e=RANK[i], b=RANK[j]+... 阅读全文