avatar
今天顶风买了[email protected]# Stock
E*e
1
【 以下文字转载自 Overseas 讨论区 】
发信人: ExpressoLove (MoneyForNothing), 信区: Overseas
标 题: 急问,人在机场,从canada回美国,人有绿卡, 不过I-94表被收走了。
发信站: BBS 未名空间站 (Wed Sep 14 15:06:04 2011, 美东)
过海关的时候, officer态度很不好。 看到我的I-94,像发现新大陆一样质疑我。 后
来旁边的officer解释说, 绿卡就是entry visa, 不需要I-94。 但是我上回从canada
回usa, 海关officer也没有检查或没收啊。这事不要紧 吧? 望过来人解疑。
另外, 过海关搞的喔很不高兴。 officer态度很不友好。我后来想想, 这种事是有
发生, 当是被苍蝇叮了一口,恶心了。
avatar
c*r
2
最近看到一道题,没什么特别好的思路,请教各位大神:
Given a string s, remove duplicate adjacent characters from s recursively.
For example:
Input: "abbac"
Output: "c", first remove adjacent duplicated 'b's, then remove adjacent
duplicated 'a'.
Input: "acbbcad"
Output" "d", first remove 'b', then remove 'c', then remove 'a'.
Input: "acbbcda"
Output: "ada"
Do it with one pass over the string.
Thx!
avatar
e*t
3
还有别人买么?不知道我买的对不?有大牛给帮着分析下么?谢谢!
avatar
Y*i
4
有绿卡了就不需要I-94了吧...
我也不太懂的说...
avatar
l*8
5
void removeDup(string & str) {
int tail = -1;
for (int i = 0; i < str.size(); ) {
if (tail < 0 || str[i] != str[tail]) {
str[++tail] = str[i++];
} else {
--tail;
while(str[i] == str[tail + 1])
++i;
}
}
str.resize(tail+1);
}
avatar
c*4
6
2 cents from a frog:
long term it is a 10+ stock, if oil stays strong and natural gas bounces
back
short term it is a pump & dump
It is a bit late to touch the oil stocks now, since the crude oil has
reached 80+
The upside is not as large as it was months ago, IMHO
avatar
g*e
7
一般来说海关会给你一张新的I94啊。。。
avatar
r*s
8
push into stack and popup if next char is the same.
avatar
e*t
9
谢谢楼上!
avatar
j*l
10
有绿卡回美国就不用再填I94了

canada

【在 E**********e 的大作中提到】
: 【 以下文字转载自 Overseas 讨论区 】
: 发信人: ExpressoLove (MoneyForNothing), 信区: Overseas
: 标 题: 急问,人在机场,从canada回美国,人有绿卡, 不过I-94表被收走了。
: 发信站: BBS 未名空间站 (Wed Sep 14 15:06:04 2011, 美东)
: 过海关的时候, officer态度很不好。 看到我的I-94,像发现新大陆一样质疑我。 后
: 来旁边的officer解释说, 绿卡就是entry visa, 不需要I-94。 但是我上回从canada
: 回usa, 海关officer也没有检查或没收啊。这事不要紧 吧? 望过来人解疑。
: 另外, 过海关搞的喔很不高兴。 officer态度很不友好。我后来想想, 这种事是有
: 发生, 当是被苍蝇叮了一口,恶心了。

avatar
S*2
11
和rtscts说的一样.
public static String removeDup(String str)
{
if(str == null || str.length() <= 1)
return str;
Stack stack = new Stack();
for(int i = 0; i < str.length(); i++)
{
char ch = str.charAt(i);
if(stack.isEmpty() || ch != stack.peek())
{
stack.push(ch);
}
else if(ch == stack.peek())
{
stack.pop();
}
}
return stack.toString();
}
avatar
g*0
12
turnaround 股票,太难了
avatar
h*8
13
pat pat,米国海关确实讨厌,尤其与加拿大的一比。感觉有的老黑officer尤甚。

canada

【在 E**********e 的大作中提到】
: 【 以下文字转载自 Overseas 讨论区 】
: 发信人: ExpressoLove (MoneyForNothing), 信区: Overseas
: 标 题: 急问,人在机场,从canada回美国,人有绿卡, 不过I-94表被收走了。
: 发信站: BBS 未名空间站 (Wed Sep 14 15:06:04 2011, 美东)
: 过海关的时候, officer态度很不好。 看到我的I-94,像发现新大陆一样质疑我。 后
: 来旁边的officer解释说, 绿卡就是entry visa, 不需要I-94。 但是我上回从canada
: 回usa, 海关officer也没有检查或没收啊。这事不要紧 吧? 望过来人解疑。
: 另外, 过海关搞的喔很不高兴。 officer态度很不友好。我后来想想, 这种事是有
: 发生, 当是被苍蝇叮了一口,恶心了。

avatar
a*0
14
不知道应该怎么理解adjacent dups 如果是连续奇数个a 那pop只能消掉两个 还剩
下一个 难道原题只计算连续两个的字母吗

【在 r****s 的大作中提到】
: push into stack and popup if next char is the same.
avatar
c*3
15
Come on, cool it off!
As someone said before, you SHOULD NOT get an I-94 once you got your Green
Card. So it appears you are suspicious to have both! It is September now,
you know!
You haven't really seen what is an ugly face, boy! Did you make it cross?
Did you back to the states, then what you are complaining about?! Chill off!

canada

【在 E**********e 的大作中提到】
: 【 以下文字转载自 Overseas 讨论区 】
: 发信人: ExpressoLove (MoneyForNothing), 信区: Overseas
: 标 题: 急问,人在机场,从canada回美国,人有绿卡, 不过I-94表被收走了。
: 发信站: BBS 未名空间站 (Wed Sep 14 15:06:04 2011, 美东)
: 过海关的时候, officer态度很不好。 看到我的I-94,像发现新大陆一样质疑我。 后
: 来旁边的officer解释说, 绿卡就是entry visa, 不需要I-94。 但是我上回从canada
: 回usa, 海关officer也没有检查或没收啊。这事不要紧 吧? 望过来人解疑。
: 另外, 过海关搞的喔很不高兴。 officer态度很不友好。我后来想想, 这种事是有
: 发生, 当是被苍蝇叮了一口,恶心了。

avatar
a*0
16
请这个thread的作者解释一下 输出是什么 baaab
avatar
r*s
17
稍微改一下,stack也可以做出来。
public static String removeDup(String str)
{
if(str == null || str.length() <= 1)
return str;
Stack stack = new Stack();
Character last = ' ';
for(int i = 0; i < str.length(); i++)
{
char ch = str.charAt(i);

if(ch!=last && (stack.isEmpty() || ch != stack.peek()))
{
stack.push(ch);
}
else if(!stack.isEmpty() && ch == stack.peek())
{
stack.pop();
}
else if (ch == last);

last=ch;
}
return stack.toString();
}
avatar
c*r
18
不好意思,题目没有解释清楚
以下是一些测试例子:
string str1 = "geeksforgeeg";
gksfor
string str2 = "azxxxzy";
ay (3个x相邻,全删掉,然后删除z)
string str3 = "caaabbbaac";
empty string
string str4 = "gghhg";
g (先删除开始的两个g,然后删除两个h)
string str5 = "aaaacddddcappp";
a
如果是”baaab“ 应该返回空串。
avatar
l*4
19
recursive和iterative各写了一下Java版本。提供的所有测试例子都通过了。
public static String remove(String s) {
if (s == null || s.length() <= 1) {
return s;
}
for (int i = 0; i < s.length() - 1; i++) {
if (s.charAt(i) == s.charAt(i + 1)) {
int j = i + 1;
while (j < s.length() - 1 && s.charAt(j) == s.charAt(j + 1))
j++;
String left = s.substring(0, i);
String right = s.substring(j + 1);
return remove(left + right);
}
}
return s;
}
public static String remove_iterative(String s) {
if (s == null) {
return s;
}
while (s.length() > 1) {
boolean containsDup = false;
for (int i = 0; i < s.length() - 1; i++) {
if (s.charAt(i) == s.charAt(i + 1)) {
int j = i + 1;
while (j < s.length() - 1 && s.charAt(j) == s.charAt(j +
1)) j++;
String left = s.substring(0, i);
String right = s.substring(j + 1);
s = left + right;
containsDup = true;
break;
}
}
if (!containsDup) {
break;
}
}
return s;
}
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。