Redian新闻
>
有人NIW是自己准备材料的吗?
avatar
有人NIW是自己准备材料的吗?# EB23 - 劳工卡
y*i
1
可以登录上去玩玩。
avatar
S*6
2
本人生物医学背景,8篇文章,四篇1作,3篇会议摘要,总引用次数80次(Google
Scholar)/56次(ISI);1次审稿,1次Video report(其实是最近一篇文章的杂志邀请
我们自己做一个video然后可以放在他们网站),打算准备6封推荐信。手上已经有其他
人的20多封推荐信的样本。
这样的情况是否还需要找律师?希望有过DIY自己NIW经历的同学能分享一下经验。
实在是舍不得5000美金给律师,好像他们除了帮忙润色推荐信以外,没干什么活啊。系
不系?系不系?
avatar
i*e
3
我昨晚登上去玩了,与 Google Codejam 相比之下逊色不少,还有满多 bug 在里面。
UI 做的很不好,甚至有很多误导性的地方。还有很多安全性的问题没考虑好,有人已
经说过可以通过 wget 来偷偷下载数据而不启动倒时。甚至有一段时间很多人都看到一
个人飚上排名榜第一名(现在已被去除),说解了总共四道题(但其实只有三道题而已
)。
总体来说题目还好,不会很难(有 topcoder 里的人在论坛里说所有题目都不是原创)
,但下一轮估计难度会提高些。
以下是我对 Hacker Cup 的一些感想。
http://www.ihas1337code.com/2011/01/facebook-hacker-cup.html
一些常见面试题的答案与总结 -
http://www.ihas1337code.com
avatar
i*t
4
很多人都自己弄的阿
avatar
P*l
5
Interesting.
The first problem is similar to one trivial interview question.
Double Squares
A double-square number is an integer X which can be expressed as the sum of
two perfect squares. For example, 10 is a double-square because 10 = 3^2 + 1
^2. Your task in this problem is, given X, determine the number of ways in
which it can be written as the sum of two squares. For example, 10 can only
be written as 3^2 + 1^2 (we don't count 1^2 + 3^2 as being different). On
the other hand, 25 can be written as 5^2 + 0^2 or as 4^2 + 3^2.
Input
You should first read an integer N, the number of test cases. The next N
lines will contain N values of X.
Constraints
0 ≤ X ≤ 2147483647
1 ≤ N ≤ 100
Output
For each value of X, you should output the number of ways to write X as the
sum of two squares.
avatar
s*3
6
I know a lot of people DIY, good luck.
avatar
h*r
7
So easy?

of
1
only

【在 P********l 的大作中提到】
: Interesting.
: The first problem is similar to one trivial interview question.
: Double Squares
: A double-square number is an integer X which can be expressed as the sum of
: two perfect squares. For example, 10 is a double-square because 10 = 3^2 + 1
: ^2. Your task in this problem is, given X, determine the number of ways in
: which it can be written as the sum of two squares. For example, 10 can only
: be written as 3^2 + 1^2 (we don't count 1^2 + 3^2 as being different). On
: the other hand, 25 can be written as 5^2 + 0^2 or as 4^2 + 3^2.
: Input

avatar
S*6
8
Thanks! I will try DIY!
avatar
P*l
9
3rd:
Studious Student
You've been given a list of words to study and memorize. Being a diligent
student of language and the arts, you've decided to not study them at all
and instead make up pointless games based on them. One game you've come up
with is to see how you can concatenate the words to generate the
lexicographically lowest possible string.
Input
As input for playing this game you will receive a text file containing an
integer N, the number of word sets you need to play your game against. This
will be followed by N word sets, each starting with an integer M, the number
of words in the set, followed by M words. All tokens in the input will be
separated by some whitespace and, aside from N and M, will consist entirely
of lowercase letters.
Output
Your submission should contain the lexicographically shortest strings for
each corresponding word set, one per line and in order.
Constraints
1 <= N <= 100
1 <= M <= 9
1 <= all word lengths <= 10
See a post:
http://www.mitbbs.com/article_t/Programming/31179801.html
blaze might have a better answer.
avatar
c*p
10
就现在这个排期, NIW自己弄弄就行了, 直接上EB1吧.
avatar
i*e
11
It's trivial to do a brute force search.
There are also mathematical properties that you can take advantage on.
However, assume you don't know these properties, how to write a program to
do this efficiently?
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

of
1
only

【在 P********l 的大作中提到】
: Interesting.
: The first problem is similar to one trivial interview question.
: Double Squares
: A double-square number is an integer X which can be expressed as the sum of
: two perfect squares. For example, 10 is a double-square because 10 = 3^2 + 1
: ^2. Your task in this problem is, given X, determine the number of ways in
: which it can be written as the sum of two squares. For example, 10 can only
: be written as 3^2 + 1^2 (we don't count 1^2 + 3^2 as being different). On
: the other hand, 25 can be written as 5^2 + 0^2 or as 4^2 + 3^2.
: Input

avatar
k*n
12
diy很容易的
avatar
P*l
13
construct a hash map from 0^2, 1^2, ... floor(sqrt(n))^2.
We know if an array have two numbers sum to a given number. Now, the
question is to extend it to find all combinations rather stop at the first
pair.

【在 i**********e 的大作中提到】
: It's trivial to do a brute force search.
: There are also mathematical properties that you can take advantage on.
: However, assume you don't know these properties, how to write a program to
: do this efficiently?
: 一些常见面试题的答案与总结 -
: http://www.ihas1337code.com
:
: of
: 1
: only

avatar
i*e
14
第三题是个很好的题目,不是你想像的那么直接,如果不小心的话很容易掉入个误区。
那个 post 提供了有关那题很好的讨论。
主要就是排序,但是前提是怎么个排序法。
例如:
sd sdab sda pq
怎么把字符串连起来 to be smallest lexicographically
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

This

【在 P********l 的大作中提到】
: 3rd:
: Studious Student
: You've been given a list of words to study and memorize. Being a diligent
: student of language and the arts, you've decided to not study them at all
: and instead make up pointless games based on them. One game you've come up
: with is to see how you can concatenate the words to generate the
: lexicographically lowest possible string.
: Input
: As input for playing this game you will receive a text file containing an
: integer N, the number of word sets you need to play your game against. This

avatar
i*e
15
I have tried this approach.
N can go up to 2147483647,
which requires at least 2GB to store the mappings.
In my C program it fails to allocate such large amount of memory on the heap.
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

【在 P********l 的大作中提到】
: construct a hash map from 0^2, 1^2, ... floor(sqrt(n))^2.
: We know if an array have two numbers sum to a given number. Now, the
: question is to extend it to find all combinations rather stop at the first
: pair.

avatar
r*y
16
感觉光是排序不行阿,比如 bc < bca
但是连起来以后 bcbca > bcabc

This

【在 P********l 的大作中提到】
: 3rd:
: Studious Student
: You've been given a list of words to study and memorize. Being a diligent
: student of language and the arts, you've decided to not study them at all
: and instead make up pointless games based on them. One game you've come up
: with is to see how you can concatenate the words to generate the
: lexicographically lowest possible string.
: Input
: As input for playing this game you will receive a text file containing an
: integer N, the number of word sets you need to play your game against. This

avatar
P*l
17
how can it be?
sqrt(2147483647)=46340.95 ~ several hundreds kB.
It should be a hash set instead. It make no sense to have a hash map with
value true/false.

heap.

【在 i**********e 的大作中提到】
: I have tried this approach.
: N can go up to 2147483647,
: which requires at least 2GB to store the mappings.
: In my C program it fails to allocate such large amount of memory on the heap.
: 一些常见面试题的答案与总结 -
: http://www.ihas1337code.com

avatar
P*l
18
public void test() {
int num = 2147483646;
// num = 100;
num = 2147395601;
Set hs = new HashSet((int) (Math.sqrt(num)) + 100);
for (int i = 0; i < Math.sqrt(num); i++) {
hs.add(i * i);
}
for (Integer i : hs) {
int j = num - i;
if (j < i)
continue;
if (hs.contains(j)) {
System.out.println(i + ", " + j);
}
}
}
2147395601 ==>
1, 2147395600
317694976, 1829700625
avatar
h*6
19
看完题就点了download input,直接废掉一题。设计的也真烂,也不像google那样扣四
分钟还可以继续。
avatar
c*n
20
isn't this the same as coins problem?
just creat your coins array os square numbers first

【在 P********l 的大作中提到】
: construct a hash map from 0^2, 1^2, ... floor(sqrt(n))^2.
: We know if an array have two numbers sum to a given number. Now, the
: question is to extend it to find all combinations rather stop at the first
: pair.

avatar
B*n
21
觉得有道理,感觉分析清楚了程序很简单。另外输入很小,用brute force也没什么问
题。M <= 9, 9! = 362880,可以作为验证。
bool StringCompare (string s1, string s2)
{
return ( (s1+s2) < (s2+s1) );
}
void PrintLeastOrder(vector words)
{
sort(words.begin(), words.end(), StringCompare);
for (int i = 0; i < words.size(); i++)
cout << words[i].c_str();
cout << "\n";
}
Output
cupfacebookforhackerstudentsstudious
duzklvrawqrc
dyroiymybeaxeyubxzdr
bwjibwjibwjijp
dcyihopjijliuiuy

This

【在 P********l 的大作中提到】
: 3rd:
: Studious Student
: You've been given a list of words to study and memorize. Being a diligent
: student of language and the arts, you've decided to not study them at all
: and instead make up pointless games based on them. One game you've come up
: with is to see how you can concatenate the words to generate the
: lexicographically lowest possible string.
: Input
: As input for playing this game you will receive a text file containing an
: integer N, the number of word sets you need to play your game against. This

avatar
c*n
22
各位大牛
你们好像经常参与code jam. topsider
之类的比赛啊
你们还是学生么?
说实在这些东西在大多数it company 没什么用, 工作了的(至少我自己)很少有兴趣
去看, 倒是 design pattern. tools, tcp, apache. 等等这些domain knowledge 跟
工作直接相关,zhi直接有效,自觉看得多。
不过domain knowledge 换个工作就没用了。

【在 h**6 的大作中提到】
: 看完题就点了download input,直接废掉一题。设计的也真烂,也不像google那样扣四
: 分钟还可以继续。

avatar
j*8
23
这个主要考的是基本民工素质和,对写程序的兴趣。facebook 之类的就是要一些脑子
不太差,又特别爱干活,有一些训练的基本民工。
不是它做的好,而是其他的真的太差啦,像google,microsoft,yahoo 之类。
其实有几个有vision的牛人 executive 就行了。这个呢,只要比其他的大公司牛就行
了。
绝大部分的大公司executives,都只是起副作用的。
avatar
i*e
24
有关第二道题 "Peg Game",
针对 example input:
3 4 1 1 1 0
从 column 1 或者 column 2 把球掉下去而达到 goal 的机率都是一样 -- 0.5.
但是根据问题 -- "there will be no ties"...
各位大牛,可以解释下这到底是为什么吗?
一些常见面试题的答案与总结 -
http://www.ihas1337code.com
avatar
i*e
25
This solution works, but suffer from two problems:
1) if (j < i) continue;
can be changed to:
if (i > floor(sqrt(num))) break; // more efficient to precalculate floor
(sqrt(num)) value and store it to a variable.
2) Your total running time is O(N) (because of hs.contains(j) has a
complexity of O(sqrt(N))). However, it is no much better than a brute force.
It is only necessary for a brute force to loop from i=0 to i=sqrt(N) and j=
i to j=sqrt(N). Therefore, the brute force's method is still O(N) and
requires no additional space.
The main problem I'm asking is, if there are 1000 repeated queries, how can
you make it efficient by not recomputing the same values over and over again
? It seemed that storing precomputed values into a table is the most
efficient one. But, we don't have such great memory for expense. The real
difficulty lies in storing the computed values using as few memory as
possible.
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

100);

【在 P********l 的大作中提到】
: public void test() {
: int num = 2147483646;
: // num = 100;
: num = 2147395601;
: Set hs = new HashSet((int) (Math.sqrt(num)) + 100);
: for (int i = 0; i < Math.sqrt(num); i++) {
: hs.add(i * i);
: }
: for (Integer i : hs) {
: int j = num - i;

avatar
i*e
26
我也是这样就废掉第一题了...
download 了 input 还要 reload 才能看到倒时,
我真是服了 FB 了!
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

【在 h**6 的大作中提到】
: 看完题就点了download input,直接废掉一题。设计的也真烂,也不像google那样扣四
: 分钟还可以继续。

avatar
P*l
27
1) You assumed the hashset keeps the order of input?
2) Yes. there is room to improve. The hashset is not necessary at all.

floor
force.
j=

【在 i**********e 的大作中提到】
: This solution works, but suffer from two problems:
: 1) if (j < i) continue;
: can be changed to:
: if (i > floor(sqrt(num))) break; // more efficient to precalculate floor
: (sqrt(num)) value and store it to a variable.
: 2) Your total running time is O(N) (because of hs.contains(j) has a
: complexity of O(sqrt(N))). However, it is no much better than a brute force.
: It is only necessary for a brute force to loop from i=0 to i=sqrt(N) and j=
: i to j=sqrt(N). Therefore, the brute force's method is still O(N) and
: requires no additional space.

avatar
i*e
28
Okay, Yes. I assumed that the hashset keeps the order of input. If not, then
I'm wrong.
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

【在 P********l 的大作中提到】
: 1) You assumed the hashset keeps the order of input?
: 2) Yes. there is room to improve. The hashset is not necessary at all.
:
: floor
: force.
: j=

avatar
P*l
29
No. In java, the hashset does not preserve the original input order. There
is another set called linkedhashset has this property.
It is brute force but the complexity is o(sqrt(n)). Because it just scan one
through 1 to sqrt(n).


then

【在 i**********e 的大作中提到】
: Okay, Yes. I assumed that the hashset keeps the order of input. If not, then
: I'm wrong.
: 一些常见面试题的答案与总结 -
: http://www.ihas1337code.com

avatar
P*l
30
Niubility! I though it should use DP.
Only one thing is odd but does not cause any different in output.
That is, "a" == "aa" == "a"+

【在 B********n 的大作中提到】
: 觉得有道理,感觉分析清楚了程序很简单。另外输入很小,用brute force也没什么问
: 题。M <= 9, 9! = 362880,可以作为验证。
: bool StringCompare (string s1, string s2)
: {
: return ( (s1+s2) < (s2+s1) );
: }
: void PrintLeastOrder(vector words)
: {
: sort(words.begin(), words.end(), StringCompare);
: for (int i = 0; i < words.size(); i++)

avatar
h*6
31
这东西到底怎么玩的?最后上传运行结果还是代码也没有弄清楚。
我有两题都超时,结果收到邮件告诉我三题全部答对。我怀疑所有参加预选赛的全部晋级了。
avatar
r*u
32
后来改了规定,因为太多人中招了,所以把时间限制去掉了。

晋级了。

【在 h**6 的大作中提到】
: 这东西到底怎么玩的?最后上传运行结果还是代码也没有弄清楚。
: 我有两题都超时,结果收到邮件告诉我三题全部答对。我怀疑所有参加预选赛的全部晋级了。

avatar
h*6
33
有人今天参加1A的比赛吗,facebook的系统老是出问题,实在令人失望啊。
做完前两题的时候,总是无法提交,无论点多少次submit,一直没有反应;还好成功提
交第三题,没有拿零蛋回家。
avatar
i*e
34
我参加了,
解完第一题之后
一直纠缠在第二道题
因为我第一个sample input的答案就不 match 他们的答案,
然后一直在检测是不是理解错误 还是代码有问题。
真是晕死了,
我的答案竟然是对的
真是他们错了,
然后他们直接把那题给取下来了
现在 subround 2 还要拖到下个星期才能举行
这样的比赛真是让我不得不服 FB
一些常见面试题的答案与总结 -
http://www.ihas1337code.com

【在 h**6 的大作中提到】
: 有人今天参加1A的比赛吗,facebook的系统老是出问题,实在令人失望啊。
: 做完前两题的时候,总是无法提交,无论点多少次submit,一直没有反应;还好成功提
: 交第三题,没有拿零蛋回家。

avatar
b*n
35
说的容易,,你以为公司那么好管的么

【在 j******8 的大作中提到】
: 这个主要考的是基本民工素质和,对写程序的兴趣。facebook 之类的就是要一些脑子
: 不太差,又特别爱干活,有一些训练的基本民工。
: 不是它做的好,而是其他的真的太差啦,像google,microsoft,yahoo 之类。
: 其实有几个有vision的牛人 executive 就行了。这个呢,只要比其他的大公司牛就行
: 了。
: 绝大部分的大公司executives,都只是起副作用的。

avatar
h*6
36
Round 1A的比赛重新举行了,这次题目的难度很大,我只做出了第一题,打算看看别人
的代码,研究一下后面两题如何解。
avatar
r*u
37
嗯,是挺难的,只有646人过了。第三题可以用矩阵表示然后用线性代数解方程,
http://online.redwoods.cc.ca.us/instruct/darnold/laproj/Fall200
我的线性代数是全忘光了。
还可以用暴力法求解,下面贴一个别人的答案:
You can bruteforce turning lights in the first row (2^18 = small enough).
Then you may light first row using second row. This can be done in only one
way. then use third row for lighting up second and so on. After that check
last row. If it is OK - count try this layout as an answer. Remember to
count turnings then you do them. it is easy.

【在 h**6 的大作中提到】
: Round 1A的比赛重新举行了,这次题目的难度很大,我只做出了第一题,打算看看别人
: 的代码,研究一下后面两题如何解。

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。