avatar
s*c
1
https://www.interviewstreet.com/challenges/dashboard/#problem/4edb8abd7cacd
简单说来,就是计算String 和所有suffix 的similarity并加和
比如 ababaa
所有suffix是 "ababaa", "babaa", "abaa", "baa", "aa" and "a"
他们与ababaa 的similarity 是 6,0,3,0,1,1 所以结果就是 6+3+0+0+1+1=11
另一个例子 aa
suffix是"aa","a"
similarity 就是 2, 1,结果是2+1=3
我的算法是先定义一个similarity function,计算任意两String的similarity值。在处
理问题的时候,生成所有的suffix,string有多长,就有多少个suffix,然后计算每个
suffix和原来String的similarity,最后相加。
运行的结果是只过了4/10个testcase。之后的报错是time limited exceeded. 做过的
人知道是什么原因吗?下面把代码贴上。
avatar
n*d
2
Seller有一个关于环境保护文件没弄好,律师问我们要不要推迟一个星期closing。
这个代价多大啊?谢谢各位给点注意。
avatar
r*e
3
剪影.gif
avatar
s*c
4
import java.io.*;
public class Solution {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.
in));
String line = br.readLine();
int N = Integer.parseInt(line);
String []strs=new String[N];
for (int i = 0; i < N; i++) {
strs[i]=br.readLine();
}

for(int i=0;i{
char start=strs[i].charAt(0);
int sumtotal=0;
StringBuffer ss=new StringBuffer();

int iLen=strs[i].length();
for(int j=iLen-1;j>=0;j--)
{
char c=strs[i].charAt(j);
ss.insert(0,c);

if(c!=start)
continue;
int sim=getSim(ss, strs[i]);
sumtotal+=sim;
}
System.out.println(sumtotal);
}
}

public static int getSim(StringBuffer s1, String s2)
{
int len=s1.length();
if(s2.length()len=s2.length();
int similar=0;
for(int i=0;i{
if(s1.charAt(i)!=s2.charAt(i))
return similar;
else
similar++;
}
return similar;
}
}
avatar
n*d
5
补充:贷款,什么都弄好了,还有一个星期close
avatar
o*4
6
哈哈
avatar
n*9
7
if your rate lock still have enough time before expiring, it will cost you
nothing unless you already arranged moving out from your current place.

【在 n***d 的大作中提到】
: Seller有一个关于环境保护文件没弄好,律师问我们要不要推迟一个星期closing。
: 这个代价多大啊?谢谢各位给点注意。

avatar
i*a
8
在哪裡找這麼熱的女僕 (maid)

【在 r*********e 的大作中提到】
: 剪影.gif
avatar
n*d
9
what if the rate expire before closing?
Thanks

【在 n*******9 的大作中提到】
: if your rate lock still have enough time before expiring, it will cost you
: nothing unless you already arranged moving out from your current place.

avatar
b*d
10
那就需要做延期,有时候是免费的,有时候是有cost的.

【在 n***d 的大作中提到】
: what if the rate expire before closing?
: Thanks

avatar
n*9
11
ask your loan officer to do an extension of rate lock. in case that your
lender will not allow you to do so, ask for the cost to re-lock. you will
save some money by delay closing from property tax, insurance cost and HOA
due.

【在 n***d 的大作中提到】
: what if the rate expire before closing?
: Thanks

avatar
p*y
12
晚住1周吧,seller本身的问题,应该不会有什么费用产生。买房这么大的事儿,还是
得手续齐全的好。
环保的文件。。。尚未遇到过,smoker certificate据说一周就只有一天township会安
排检查,一旦fail了,就得多等一周。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。