由买买提看人间百态

topics

全部话题 - 话题: merge
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)
u*a
发帖数: 113
1
来自主题: LosAngeles版 - map routing/direction test (转载)
【 以下文字转载自 THU 讨论区 】
发信人: ura (uraneous), 信区: THU
标 题: map routing/direction test
发信站: BBS 未名空间站 (Mon Jun 20 19:47:43 2011, 美东)
direction from chengdu
to 1330 S Carmelina Ave, Los Angeles, CA 90025-1903
Site:
http://www.bing.com
Solution:
Driving directions are not available for a route of this length.
Site:
http://map.google.com
Solution:
Driving directions to 1330 S Carmelina Ave, Los Angeles, CA 90025
1.
1.
37 days 14 hours
I-5 S
16,996 km
This route has tolls. - mo... 阅读全帖
u*a
发帖数: 113
2
来自主题: Joke版 - map routing/direction test (转载)
【 以下文字转载自 THU 讨论区 】
发信人: ura (uraneous), 信区: THU
标 题: map routing/direction test
发信站: BBS 未名空间站 (Mon Jun 20 19:47:43 2011, 美东)
direction from chengdu
to 1330 S Carmelina Ave, Los Angeles, CA 90025-1903
Site:
http://www.bing.com
Solution:
Driving directions are not available for a route of this length.
Site:
http://map.google.com
Solution:
Driving directions to 1330 S Carmelina Ave, Los Angeles, CA 90025
1.
1.
37 days 14 hours
I-5 S
16,996 km
This route has tolls. - mo... 阅读全帖
u*a
发帖数: 113
3
来自主题: THU版 - map routing/direction test
direction from chengdu
to 1330 S Carmelina Ave, Los Angeles, CA 90025-1903
Site:
http://www.bing.com
Solution:
Driving directions are not available for a route of this length.
Site:
http://map.google.com
Solution:
Driving directions to 1330 S Carmelina Ave, Los Angeles, CA 90025
1.
1.
37 days 14 hours
I-5 S
16,996 km
This route has tolls. - more info »
This route includes a ferry. - more info »

Chengdu, Sichuan
China

1. Head west on 人民东路 toward 人民... 阅读全帖
p*****2
发帖数: 21240
4
来自主题: JobHunting版 - 我的面试题总结
好多人问,我就发到这里吧。
面试题的构成和分类
首先声明一下,这里的面试题主要所指数据结构和算法的题目,题目的分析集中在
Leetcode上面的题目上。
我认为一道面试题由以下几个方面组成的
Question
Data structure in question
Data structure in solution
Algorithm in solution
Coding
题目:非常关键,一个题目通常有一些相应的变形题目,同一个题目可能有不同的要求
。比如时间复杂度,空间复杂度的要求,比如recursive,
iterative的要求。而根据题目的变形与要求,可能会极大的影响到你能够采取的数据
结构和算法。
问题中的数据机构:问题中有可能带数据结构,有可能没有数据结构,有可能是可以自
定义数据结构
解决方案中的数据结构:可以是in-place的,也就是利用已有的数据结构,也可能是创
建新的数据结构。新的数据结构跟已有的数据结构没有必然的联系,而很多问题都是一
题多解,可能采取不同的数据结构。
算法:一般来说,当解决方案中的数据结构确定以后,算法也就确定了。同样,一旦解
决方案的算法确定... 阅读全帖
p*****2
发帖数: 21240
5
来自主题: JobHunting版 - 我的面试题总结
好多人问,我就发到这里吧。
面试题的构成和分类
首先声明一下,这里的面试题主要所指数据结构和算法的题目,题目的分析集中在
Leetcode上面的题目上。
我认为一道面试题由以下几个方面组成的
Question
Data structure in question
Data structure in solution
Algorithm in solution
Coding
题目:非常关键,一个题目通常有一些相应的变形题目,同一个题目可能有不同的要求
。比如时间复杂度,空间复杂度的要求,比如recursive,
iterative的要求。而根据题目的变形与要求,可能会极大的影响到你能够采取的数据
结构和算法。
问题中的数据机构:问题中有可能带数据结构,有可能没有数据结构,有可能是可以自
定义数据结构
解决方案中的数据结构:可以是in-place的,也就是利用已有的数据结构,也可能是创
建新的数据结构。新的数据结构跟已有的数据结构没有必然的联系,而很多问题都是一
题多解,可能采取不同的数据结构。
算法:一般来说,当解决方案中的数据结构确定以后,算法也就确定了。同样,一旦解
决方案的算法确定... 阅读全帖

发帖数: 1
6
来自主题: Military版 - 12月10日 可能的历史
Yarmouth Port, Massachusetts
From Wikipedia, the free encyclopedia
Yarmouth Port, Massachusetts
Census-designated place
Boardwalk at Bass Hole
Location in Barnstable County and the state ofMassachusetts.
Coordinates: 41°42′17″N 70°13′15″WCoordinates: 41°42′17″N 70°13′
15″W
Country United States
State Massachusetts
County Barnstable
Town Yarmouth
Area
• Total 6.47 sq mi (16.76 km2)
• Land 6.04 sq mi (15.65 km2)
• Water 0.43 sq mi (1.11 km2)
Elevation 52 f... 阅读全帖

发帖数: 1
7
来自主题: Military版 - 12月25日 圣诞节快乐!
在网上发现了一个圣诞节商店,商店的建筑很有特色,而且遍布全美国,大概有70多个
店铺,以后大家买圣诞节用品可以去那里,似乎各州都有。我们这里和麻州的地址是:
CHRISTMAS TREE SHOP AUGUSTA, GA, 239 ROBERT C. DANIEL JR. PARKWAY,
AUGUSTA EXCHANGE, AUGUSTA, GA 30909, 706.738.0570, CHRISTMAS TREE SHOP
, MAGNOLIA PARK, 1117 WOODRUFF ROAD, GREENVILLE, SC 29607. 864. 297.
3667
CHRISTMAS TREE SHOPS NATICK, 1298 WORCESTER ST. ROUTE 9, SHERWOOD
PLAZA, NATICK, MA 01760, 508.655.9800
CHRISTMAS TREE SHOPS SOMERVILLE, 177 MIDDLESEX AVENUE, ASSEMBLY SQUARE
... 阅读全帖
r*****e
发帖数: 620
8
来自主题: Automobile版 - 问个高速并线的问题
今天跟着前面一辆车上高速,在ramp上前车的速度就很慢
上了高速以后它也迟迟不并入主lane,而是慢吞吞地在merge lane上开
这段merge lane虽然比较长,但最后还是会merge的
而我上了高速以后就并入主lane了,开在前车的左后方
暂时不敢超它,因为害怕前方merge lane结束,它随时会并进来,
所以我也比较慢,可就在这时候我的lane上,后面一辆十八轮快速冲了上来
我左边有车,不能往左边并,也不敢加速,怕前车从merge lane并进来
只好紧急并又回了merge lane, 幸好十八轮找了个空,自己并到左边去了
我想问,在这种情况下,我是一定要等前车先merge到主lane上, 自己再merge么?
万一它墨迹,慢吞吞开,最后才并,我岂不是很被动
因为我被它挡住视线,不知道什么时候merge lane会结束
但是如果不等前车并线,我就先并了,那碰上今天这情况咋办,还得并回merge lane
万一这时候这个极品车减速,我连并回merge lane的机会就都没有了
反应时间就这么零点几秒,打灯都来不及
上高速时候碰上这种极品车,怎么样才最安全?
w******i
发帖数: 1476
9
来自主题: JobHunting版 - 一个很全SAS Interview Q. List [ZT]
SAS Interview Questions from http://www.sconsig.com/
Very Basic
What SAS statements would you code to read an external raw data file to a DATA
step?
How do you read in the variables that you need?
Are you familiar with special input delimiters? How are they used?
If reading a variable length file with fixed input, how would you prevent SAS
from reading the next record if the last variable didn't have a value?
What is the difference between an informat and a format? Name three informats
or format... 阅读全帖
S**I
发帖数: 15689
10
☆─────────────────────────────────────☆
gzou (gzou) 于 (Thu May 12 02:26:35 2011, 美东) 提到:
马上就要G on site了,
求祝福。
下面是从本版收集到的Google的试题,便于大家查询。
申明:有的附带有解释说明的,也来自于本版或者网络,大家自己看, 不保证真确
http://www.mitbbs.com/article_t1/JobHunting/31847453_0_1.html
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array... 阅读全帖
S**I
发帖数: 15689
11
☆─────────────────────────────────────☆
gzou (gzou) 于 (Thu May 12 02:26:35 2011, 美东) 提到:
马上就要G on site了,
求祝福。
下面是从本版收集到的Google的试题,便于大家查询。
申明:有的附带有解释说明的,也来自于本版或者网络,大家自己看, 不保证真确
http://www.mitbbs.com/article_t1/JobHunting/31847453_0_1.html
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array... 阅读全帖
c*******g
发帖数: 2990
12
来自主题: Automobile版 - 问个高速并线的问题
我觉得是你车速慢, 没有和左后车(18轮)有足够距离,就强行merge,merge完还不赶紧
加速。我觉得如果是小车的话,其实还好,它可以减速,但是18轮减速比较慢,所以就
会造成危险。你不应该管你前面的慢车,他想merge,自然会check,你merge完就应该
赶紧加速到正常车流的车速。如果你怕他没看到你要merge,你可以滴一下,不过基本
没啥人在这种情况下滴人。
其实merge常常有后车先merge,因为旁边车道有车肯定先超过后车,所以后车就可以比
前车先merge,非常常见。
merge还是尽量和旁边车道速度差不要太大,你这种前面车速慢的情况,你要更慢和前
车拉开距离,才有加速空间顺利merge。
p*****2
发帖数: 21240
13
来自主题: JobHunting版 - 今天计划做20题

Id Question Difficulty Freqency Data Structures Algorithms
1 Two Sum 2 5
array
set
sort
two pointers
2 Add Two Numbers 3 4
linked list
two pointers
math
3 Longest Substring Without Repeating Characters 3 2
string
hashtable
two pointers
4 Median of Two Sorted Arrays 5 3
array
binary search
5 Longest Palindromic Substring 4 2
string
6 ZigZag Conversion 3 1
string
7 Reverse Integer 2 3
math
8 ... 阅读全帖
w*r
发帖数: 2421
14
来自主题: Database版 - 来做sql题目。
这个code不是MYSQL,在Teradata上测试通过,基本的语法应该和ANSI接近
解释一下解题的思路
目标:使用ID做为group by用min/max处理begin/end
第一步:要把不同行的begin/end放到同一行,这样便于比较start/end. Beijing和其
他的同学提到lag,不幸的是我这里木的用,所以用row_number()给数据按照startdate
排序做left join seq = seq+1
code:
(
SELECT T.*,
ROW_NUMBER() OVER (PARTITION BY ID ORDER BY STARTDATE) AS SEQ
FROM T
) A
LEFT OUTER JOIN
(
SELECT T.*,
ROW_NUMBER() OVER (PARTITION BY ID ORDER BY STARTDATE) AS SEQ
FROM T
) B
ON
A.ID = B.ID AND
B.SEQ = A.SEQ+1
第二步:把能够merge的行标上。注意:第一步的结果中最后一行的右边是null,所以这
里有一个la... 阅读全帖
xt
发帖数: 17532
15
来自主题: Science版 - 什么排序法最好?

冒泡法不见得简便啊,下面是merge sort:
Sort(A)
//A: n elements to be sorted
return merge-sort(A, 1, n)
end
merge-sort(A, p, q)
//merge-sort(A, p, q): sort the p-th to q-th elements in A
r = (p+q)/2
if (p=q) return A
else return merge(merge-sort(A, p, r), merge-sort(A, r+1, q))
end
merge(A1, A2)
//precondition: A1, A2 are sorted
n1 = length(A1) //Number of elements in A1
n2 = length(A2) //......................A2
pos1 = 1 //current position in A1
pos2 = 1 //..........
l**********8
发帖数: 305
16
来自主题: Statistics版 - SAS macro Debug

************************************************************
上个完整的LOG, 谢谢大家了
****************************************************************
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds

25
26 *-----------------------------------------------------;
27 %macro process(year,yr,file,first,numobs);
28
29 data cartemp;
30 set loc.carl&year.
31 (firsto... 阅读全帖

发帖数: 1
17
来自主题: Military版 - 12月10日 可能的历史
12月10日 可能的历史
前一天夜晚我一夜没睡,因为那一天晚上有人被扔下下水道了,我不知道是不是我的孩
子。因为前一天孩子上学前要一张小时候的照片,我想也许他想留个纪念。照片一直都
放在女儿房间储藏室,所以,我搬了椅子上去拿他的相册,儿子的照片有两本,我拿的
是那本我和先生共同给他建立的那一本,给了他在我肚子里的一张照片。 很可能他们
没有如愿离开。我不知道发生了什么,我在楼下听儿子说照片是他拿的 (他怕他们伤
害我?主动承担责任?)。然后他房屋的门被锁上,我担心我的儿子被他们害了。我很
长时间都没有去看那些照片,因为我曾经浏览过,都是过去的照片。而最新的照片都被
他们偷走了,特别是关于女儿的照片偷的一干二净。我没事,就把相册都抱下来再次查
看,发现很多东西被篡改或擦掉了,就连合影也是被合成的。为了防止所有的照片被销
毁,我就把他们都收起来了。其实,很多时候,我不是不知道某个人不是我的丈夫,而
是我不希望每一个人遇害,所以我沉默。我是不知道我先生如果还活着,如果一个被折
磨的人,会变成怎样? 我无法知晓。但过去的他,即使没有照片,我也逐步忆起。有
一些人,我会有困惑,但有一些人,我... 阅读全帖
j*****g
发帖数: 223
18
总结一下面试的准备活动,希望有帮助.
==================== AREAS/TOPICS to study/prep/review ====================
复习的东西还挺多的。比不过刚毕业的呀 :), 脑子不好使了,东西也差不多忘光了...
嘿嘿....
• Sorting
o Bubble/select/insertion/counting/qsort/heap/merge/bst
o Time/space complexity analysis
• Caching design
o Replacement policy (LRU, LFU, NRU, etc…)
o Efficiency/complexity/performance
o Distributed cache
o Hashing
• Multi-thread
o Locking/mutex/semaphore/critical sec... 阅读全帖
j*****g
发帖数: 223
19
总结一下面试的准备活动,希望有帮助.
==================== AREAS/TOPICS to study/prep/review ====================
复习的东西还挺多的。比不过刚毕业的呀 :), 脑子不好使了,东西也差不多忘光了...
嘿嘿....
• Sorting
o Bubble/select/insertion/counting/qsort/heap/merge/bst
o Time/space complexity analysis
• Caching design
o Replacement policy (LRU, LFU, NRU, etc…)
o Efficiency/complexity/performance
o Distributed cache
o Hashing
• Multi-thread
o Locking/mutex/semaphore/critical sec... 阅读全帖
l*********8
发帖数: 4642
20
来自主题: JobHunting版 - A家白板interview失败
我也写一个第二题,还没测呢。
void GetReversedSortedUnion(vector a, vector b, vector &
merged)
{
for (int i=a.size()-1, j=b.size()-1; i>=0 || j>=0; ) {
if (j < 0 || a[i] < b[j])
merged.push_back(a[i--]);
else
merged.push_back(b[j--]);

int n = merged.size();
if (n >= 2 && merged[n-1] == merged[n-2])
merged.pop_back();
}
}
d********g
发帖数: 10550
21
fresh/entry level问git挂可以接受,experienced这就是基础知识
merge还是好的,他没问你rebase,还有啥时候merge啥时候rebase
merge相当于你当前branch和parent branch相交到一个点创建一个新的commit,如果两
条线有冲突就会在HEAD给你在文件里列出,手动解决后(也可自动解决,指定用哪一个
branch的,但一般手动更安全),重新add一下冲突文件然后再merge。这个merge会搞
出一个新的merge commit点,如果团队很多人一起开发会有大量无意义的merge log,
得分情况搞rebase。类似的还有--no-ff这个选项怎么用,为什么
这就是看你有没有正经的团队开发经验。要是用过git-flow这套流程,估计面试官得给
你跪了
f*******r
发帖数: 976
22
来自主题: JobHunting版 - 问一道airbnb的面试题
题目就是external sort的思想。统计单词的次数,明显用map。注意文
件很大,要用long,以免溢出。
在你读文件并且增加这个map时,内存不够用,这是你要把临时结果写入临时文件。你
可以设计一个threshold,比如1 billion,当map的size达到这个值时,你就把map和临
时文件merge到另一个临时文件里。最后再把这个文件rename到原来的临时文件。再把
map清空,继续读原文件直到结束。 C++代码如下:
// Split the string into words that consists of a..z and A..Z.
void split(const string &s, vector &res) {
int beg = -1;
for (int i = 0, e = s.size(); i < e; ++i) {
if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) {
if (beg == ... 阅读全帖
E***g
发帖数: 188
23
没看见上quennsboro, 能不能再指点一下?谢谢!
8. Merge onto I-287 S via the ramp to NJ-440/I-95/Raritan Center/Perth Amboy


9. Take the I-95/NJ Turnpike exit
Toll road

10. Keep right at the fork, follow signs for New York
Toll road
11. Keep right at the fork and merge onto I-95 N
Toll road
12. Take exit 13 to merge onto I-278 E toward Goethals Bridge/Verrazano
Bridge
Partial toll road
Entering New York
13. Take exit 35 toward I-495 E/48 St

14. Take exit 35E toward I-495 E/Eastern Long Is/Rive... 阅读全帖
s*****h
发帖数: 44903
24
☆─────────────────────────────────────☆
ThetaWave (Theta) 于 (Tue Jan 12 20:23:16 2016, 美东) 提到:
---Teams that have more significant changes over the years or were more
recently expanded, in reverse chronological order when the last change
happened to a team:
Los Angeles Rams <==2016 St. Louis Rams <==1995 Los Angeles Rams <==1946
Cleveland Rams <==1936 "formed"
Houston Texans <==2002 "expansion"
Cleveland Browns <==1999* "expansion", Cleveland Browns(OLD)
* the new Browns holds the legacy of... 阅读全帖
s*****g
发帖数: 3527
25
来自主题: Automobile版 - 尼马我让你竖中指
你这是胡说八道,不要误导别人!
http://www.michigan.gov/msp/0,4643,7-123-1586_27094-73839--,00.
When merging onto a freeway who has the right-of-way?
Answer: MCL 257.649(7) governs this question. A driver entering a roadway
from a roadway that is intended for and constructed as a merging roadway,
and is plainly marked at the intersection with the appropriate merge signs,
shall yield the right-of-way to traffic upon the roadway that is so close as
to constitute an immediate hazard and shall adjust their speed ... 阅读全帖
l*********9
发帖数: 23
26
昨天高速上撞车了...幸好车轻伤人没事
我从michigan 95转大弯后进入696,过了白色实线后我就merge到右lane(因为需要在下
一个出口出),merge完后估计几秒,突然被后面一个dodge suv从右侧撞了,车右前方
(camry轮子与车灯中间)保险杠被撞扁约30厘米长,轮胎中间挡板上也有划痕,车灯擦
到一点,但没碎。当时check了后视镜与盲区,没车才merge的,但那条lane也是696一
个大弯过来,所以很快就能开到这个位置。接着两个车停着等警察。我与警察解释我已
经完成merge了,就被撞上了。他说若这样应该是撞后面,我说后车可能开在我的右面
。。。(本人新手,因为刚merge完lane,看前方,完全没看到有个车撞过来,还没反应
到就被撞了)。不知对方怎么解释的。后来警察说因为我换线,就是我要付责任,他说
短时间也解释不明白,说不给我ticket,然后我们双方各找自己的保险公司。
。。。事后回想一下,可能是我merge到的那条lane在696那个大弯是两条变一条的,比
较宽,那车想超我,我速度没她快,就撞上了。也不知这样的是谁负责任。
一个在Dealer工作的朋... 阅读全帖
r****o
发帖数: 1950
27
来自主题: JobHunting版 - 也问一个median的问题
大家看看我的想法对不?
可以模仿merge sort,先考虑N为偶数的情况
设这N列为c1,c2,...,cN
将c1和c2, c3和c4, ..., c_{N-1}和cN 两两 merge成一个长2N的列,设为d1,d2,...d_{N/2}
然后再将d1和d2,d3和d4,...,d{N/2-1}和d{N/2}两两merge成一个长4N的列,
如此反复merge,直到最后剩下两个长N*N/2的列,用binary search可找到median。
时间复杂度,O(N)+O(2N)+...+O(N*N/2)+O(2lgN)=O(N^2 lgN).
空间复杂度O(N^2).
当N为奇数时,可将最中间那列先空着,当左右两边都merge成了长(N-1)N/2的列后,再merge成一个长(N-1)N的大列,然后问题可归结为一个长(N-1)N的列和一个长N的列,都排好序,找median的问题。
时间复杂度和空间复杂度应该和偶数时一样。
c********t
发帖数: 5706
28
来自主题: JobHunting版 - onsite后收到A家的拒信,面经。
还真的不是nalogn
举例:3 1 4 2
第一次,3 1比较,4 2比较,读了4次 结果 1 3 2 4
第二次 1 3 与 2 4 merge, 1 2比较 3 2比较 3 4比较, 读了 6次 结果1 2 3 4
所以对于4个数,一共10a次 != a*4log4 (8a)。difference是因为merge步骤有的数要
反复读。
我计算出了前面6次的结果
0 2 6 10 16 22 28 34
归纳法,因为merge sort对n先split,分别处理完两段,再merge,所以公式如下:
f(1)=0
if even: f(2n)=2*f(n)+ (2n-1)*2 (2*f(n)是两段的cost, (2n-1)*2是merge的cost)
if odd: f(2n+1)=f(n)+f(n+1)+(2n)*2(f(n)+f(n+1)是两段的cost, (2n)*2是merge的
cost)
数学不行,哪位大侠能简化写成 f(n)=lg(n)...
j*****y
发帖数: 1071
29
来自主题: JobHunting版 - onsite后收到A家的拒信,面经。
感觉递归式子就是
T(n) = 2T(n / 2) + O(an), 用 master定理算出来就是
an log n 阿

还真的不是nalogn
举例:3 1 4 2
第一次,3 1比较,4 2比较,读了4次 结果 1 3 2 4
第二次 1 3 与 2 4 merge, 1 2比较 3 2比较 3 4比较, 读了 6次 结果1 2 3 4
所以对于4个数,一共10a次 != a*4log4 (8a)。difference是因为merge步骤有的数要
反复读。
我计算出了前面6次的结果
0 2 6 10 16 22 28 34
归纳法,因为merge sort对n先split,分别处理完两段,再merge,所以公式如下:
f(1)=0
if even: f(2n)=2*f(n)+ (2n-1)*2 (2*f(n)是两段的cost, (2n-1)*2是merge的cost)
if odd: f(2n+1)=f(n)+f(n+1)+(2n)*2(f(n)+f(n+1)是两段的cost, (2n)*2是merge的
cost)
数学不行,哪位大侠能简化写成 f(n)=lg(n)...
p*******m
发帖数: 47
30
我5月初要去Twitter onsite,面的是 Trust & Safety team
2轮电面都比较简单,2个engineers都很nice.
但听说onsite 难度会明显加大, 而且我网上能搜到的它家的题目不多,特别是onsite,
所以心里没底,来版上求经验。
希望有面试经验的同学能和我分享, 如果不方便帖出来,你也可以我站内发信或者
email: d********[email protected]
这是recruiter给我的schedule:
11:30am 去公司签到, 然后面7个人, 其中有个 team Product Manager。每轮45min,
第1轮是 lunch interview,
7轮分别有coding, Ph.D. research presentation, large-scale system design (这
个是open question)
下面是我搜集到的Twitter的题目,有些版上有过了,给后来的同学作参考。
如果你们有新的题, 也可以回在下面.
希望版上它家的信息能多些
++++++++++++++++++++++++++++++++++++... 阅读全帖
v*********3
发帖数: 40
31
来自主题: JobHunting版 - codility的两道题
不好意思,可能表达的不清楚。比如说[100, 200, 400],merge的时间有三种,先
merge前两个需要(100+200)=300,然后merge第三个是(300+400)=700,一共需
要300+700 = 1000.。或者先merge后两个需要(200+400)=600,然后merge第一个
是(100+600)=700,一共需要600+700=1300. 或者是先merge第一个和第三个,过
程类似。求最小可能的时间。
s*****l
发帖数: 9
32
来自主题: JobHunting版 - 问个CareerCup上external sort的题
第四版10.4
Imagine you have a 20GB file with one string per line. Explain how you
would sort the file.
答案是external sort,先分若干chunk,把每个chunk放到memory里sort后放回去,然后再
merge.
我的疑问是
1)答案是one chunk by one chunk 的merge,这是不是代表不需要其他空间来merge,就
是速度慢了点,假设memory的size是1GB,是不是代表merge 20次?
2)如果采取20个一起merge的话,是不是系统还要再给个20GB的disk的临时空间,以便
存merge后的结果再放回去?
谢谢啦
b****t
发帖数: 112
33
来自主题: JobHunting版 - 求问一道MS面试题
基本步骤无非是sort(per machine)和merge(external merge).
1) Sort
for each machine:
sort top 1 Billion
2) Merge
merge 1 * 10 Billion into 1 Billion
优化设计:并行处理。设立中央控制器。
效果:a. 不必每个机器都占用1 billion内存 b.并行处理, 节约时间
Assume there is one independent server as the sorting controller.
The controller does the external file merge.
On each machine:
while (true)
{
communicate with controller:
{
get current low boundary
upload sorted value to the controller to merge
empty local cached
}
sort
{
... 阅读全帖
l***h
发帖数: 96
34
来自主题: JobHunting版 - G家电面面经【已过HC,求祝福啊】
上上周五去MTV onsite的,这周一HR说HC已经过了,等这周EC省材料,下周给我消息。
希望不要在最后一步出啥问题吧。
电面题目:
一位国人大哥,先在这里谢过啦,时间刚好45分钟,吐槽下Google docs上写程序好蛋
疼,什么时候可以搞个可以支持Vim的编辑器吧。。。。
Assume some binary (each pixel is either black or white ) images, have same
width and height, and the length is power of 2. Present it by quadtree:
divide the image into quarters, each quarter can be all back, all white or
mixed, subdivide the mixed ones… recurse.
+-------+---+---+
| | F | F |
| T +---+---+
| | T | T |
+---+---+---+---+
| F ... 阅读全帖
y*****e
发帖数: 18
35
来自主题: JobHunting版 - 若问OJ的insert interval这题
/*
Algorithm: Modified Binary search
[1,3],[6,9], insert and merge [2,5] in as [1,5],[6,9].
1. BSearch to find the 'first' interval whose end >= newInterval.start.
If does not find, the new interval should be appended at the tail.
2. BSearch to find the 'last' interval whose start <= newInterval.end.
If does not find, the new interval should be inserted before the head.
3. Erase the found 'first' to 'last' intervals and insert the new merged
interval at index 'first'
*/
vector i... 阅读全帖
y*****e
发帖数: 18
36
来自主题: JobHunting版 - 若问OJ的insert interval这题
/*
Algorithm: Modified Binary search
[1,3],[6,9], insert and merge [2,5] in as [1,5],[6,9].
1. BSearch to find the 'first' interval whose end >= newInterval.start.
If does not find, the new interval should be appended at the tail.
2. BSearch to find the 'last' interval whose start <= newInterval.end.
If does not find, the new interval should be inserted before the head.
3. Erase the found 'first' to 'last' intervals and insert the new merged
interval at index 'first'
*/
vector i... 阅读全帖
f******h
发帖数: 45
37
也找工作了一段时间了,从版上学了很多,上周G家面完了,求个bless。
之前的一些都挂了,还在继续找其他的。等定下来之后一定发面经回报本版。
谢谢大家啦!!
1. http://www.mitbbs.com/article_t/JobHunting/32005597.html
1) Implement a simple calculator (+,-,*,/);
2) Implement "+1" for a large integer;
3) How to match Ads to users;
4) How to extract useful information from a forum webpage (list all
kinds of useful signal you can think of)
5) How to detect the duplicate HTML pages (large scale);
6) Find all the paths between two places on Google map;
7)... 阅读全帖
r****s
发帖数: 1025
38
我靠,你都不知道merge是啥吧?
SVN merge, 如果没有conflict,几秒钟的事,我老还真来不及感觉痛苦。
git merge,如果有conflict,你点亮一下我老,如何自动merge? 那还不得一行一行地
人工对程序,搞不好还得叫过来TPM核对biz logic,merge之后还得再来一轮code
review才行。
还尼玛轻松merge。扯鸡巴蛋。
p******o
发帖数: 4
39
来自主题: JobHunting版 - G家电面(已挂)

澄清一下: N 定义为 size of input list. K 定义为 number of list.
递归调用 merge 2 sorted list: 每次merge N*K records, 递归树深度 lg(K). 所
以我回答 N*K* lg(K)
Heap: heap size K, total N*K records. 也是 N * K * lg(K)
主要问题是在实际应用中 recursive merge 2 sorted 需要多次读写disk. 我一开始回
答说merge K list 可以 code-reuse merge 2 list (本来以为要写code, 已经写了
merge 2 sorted, 写一个新函数就可),但这显然不是他想听到的
r*****y
发帖数: 264
40
来自主题: NewJersey版 - Fort Lee commute to WTC
走59街桥的线路我开过很多次,就是在河东岸有时候有一段会堵一点。总体都还不错。
GPS上设59街桥为via point就可以了。
Google Map上的路程:
Fort Lee, NJ

1. Head southwest on Lemoine Ave toward Hoym St
2. Take the 1st right onto Hoym St
3. Take the 2nd right onto Center Ave
4. Turn right onto the ramp to US-9 N
5. Slight left onto US-9 N Partial toll road
6. Merge onto Interstate 95 Upper Level N Partial toll road
Entering New York
7. Take exit 2 for Amsterdam Avenue toward University Avenue
8. Merge onto... 阅读全帖
T*******e
发帖数: 4110
41
---Teams that have more significant changes over the years or were more
recently expanded/relocated, in reverse chronological order when the last
change happened to a team:
Las Vegas Raiders <==2020? Oakland Raiders <==1995 Los Angeles Raiders <==
1982 Oakland Raiders <==1960 "formed"
Los Angeles Chargers <==2017 San Diego Chargers <==1961 Los Angeles
Chargers <==1960 "formed"
Los Angeles Rams <==2016 St. Louis Rams <==1995 Los Angeles Rams <==1946
Cleveland Rams <==1936 "formed"
Houston Texans ... 阅读全帖
i***m
发帖数: 148
42
很好的经验,然后我加一些自己的经验供大家讨论

SAS
(1) Proc transpose
(2) Merge data的时候要注意什么问题?
a. Have to sort both tables before merging
b. Check what’s the type of merge (one to many, one to one, or many to
many?) --- check duplicates in each table (这条很多经验不够的通常都想不到
,只想到sort)
c. What if you only want to keep the IDs in table a?
--many to many merge, data step 与sql的不同
--missing data在merge时的处理,尤其是primary key有missing时
(3) Array
If you have a data set a with 1000 columns, you want to change all the
mi... 阅读全帖
o*********e
发帖数: 3093
43
来自主题: Military版 - Linux哪个版本的比较易用
月光阿姨,我问你,我刚刚想在自己电脑上装Drupal来玩玩,结果出现这么多问题,咋
整?
是哪些问题造成怎么多问题?
Skip to main content
Drupal 8.4.3
Installation tasks
Choose language
(active)
Choose profile
Verify requirements
Set up database
Install site
Configure site
Choose language
Error message
Deprecated function: assert(): Calling assert() with a string argument is
deprecated in DrupalCoreCacheMemoryBackend->set() (line 101 of
corelibDrupalCoreCacheMemoryBackend.php).
DrupalCoreCacheMemoryBackend->set('module_implements', Array) (Line: 359)
D... 阅读全帖
d***y
发帖数: 231
44
就在去看牙医的路上,从高速的RAMP上下来,前面一辆VAN等着MERGE到大路上,而我,
等着它MERGE完,再MERGE..看着前面车已经发动准备MERGE了,于是我迅速扭头准备看
旁边有没有车,准备merge,不知怎么的,突然就发现俺的车以掩耳不及盗铃的疯狂速
度亲上了前面那辆VAN的PP,大叔VAN的玻璃一片粉碎,洒落在地上。。。俺都不知道发
生了什么,立即战战兢兢的给POLICEMAN打电话,POLICEMAN来了,说这个小的事故,完
全不用打电话给911:(郁闷。。。然后互换了信息,俺发现那辆97年的VAN居然跑了87
万迈之多。。天啊!俺的TOYOTA估计是活不到这个岁数的。不知道保险公司会怎样裁决
,有达人指点下么?:)。。。
a*********g
发帖数: 8087
45
来自主题: Automobile版 - 尼马我让你竖中指
那篇文章里面说的有道理的
高速上一般的加速道本身就是属于高速的一部分了,相当于在那一段高速多了一条lane
,那时候从加速道merge到右道就相当于普通的merge,所以双方都谈不上有绝对的路权
,只能看情况而定
就相当于local有些路段,2lane变成1lane的情况,假如右lane将要消失,你不能说左
lane就比右lane更有路权,在右lane消失之前,两条lane仍然是平等的,只是那种情况
右lane的车有更迫切的需求要merge过来。
以上的情况就是普通的merge,merge过来的车只要能把屁股抹正,那就算换道完成,后车撞上就是追尾要负责了,最多
能argue对方不安全换道,但这就是普通的扯皮了
那种加速道尽头有yield,甚至没有加速道的高速入口,显然和上面情况不一样,进高
速的要让,就跟local小路上大路一样
o*****s
发帖数: 2071
46
不可能吧?问问goFan,它是本版volvo第一粉丝,不过他自己死活也不会买新volvo的
,肯定有他自己的道理:
1 * goFan Sep 11 Re: 夜间如何正确示意别人先走?
2 * goFan Sep 11 考考你,空调低压管压力超高,没冷气
3 * goFan Sep 11 Re: 夜间如何正确示意别人先走?
4 * goFan Sep 11 Re: volvo xc90 还是卖msrp 吗?
5 * goFan Sep 11 Re: volvo xc90 还是卖msrp 吗?
6 * goFan Sep 11 Re: 考考你,空调低压管压力超高,没冷气
7 * goFan Sep 11 Re: 奇怪的毛病 刹车有问题还是?
8 * goFan Sep 11 尼玛空调导致 coolant 不知道哪里泄漏,怎么回事
9 * goFan Sep 11 Re: 为啥... 阅读全帖
e****y
发帖数: 276
47
来自主题: Automobile版 - 驾车恶习
拐弯不打转向灯, tailgating, 低于限速霸占左车道, 是些常见的驾车恶习。
今天说一个上highway在merge area 初段低速强行并线。
危险度:6
讨厌度:8
高速入口处,都有一段“加速区”(entrance ramps/acceleration area)。这段路的
作用就是供上高速的车辆提速的区间。当进入 merge area (与高速平行段)时,车速
应达到高速路上车流的速度,择机并入主线。
如果进入merge area 车速仍很慢,应赶紧利用那段平行merge area提速,在merge
area 结束之前并线,而不是一上来就横着抢道并线。
k**u
发帖数: 698
48
来自主题: FleaMarket版 - [sold][出售] delta skymiles 74K @ 1.25
那我澄清一下.算错了请指正
假设我给您merge好,那就是一个74K账户,按 1.25算 = 925. 因为74K已经基本够买机
票了,而且这1.25里面也包含了我merge 所需的$225手续费。如果你还要再次merge,那
就不合适了。
如果你不需我Merge,这样我最大的29K账户还是按 1.25算。其余的按0.75算。
基本上就是74K*0.0125减去merge 手续费。
again 如有算错请指正
d******a
发帖数: 238
49
这个帖子有些讨论。
http://www.careercup.com/question?id=3887563
下面这个算法觉得对不?感觉不像线性时间的。
void merge (node *tree1, node *tree2) {
if (tree2->val <= tree1->val) {
node *right_child = tree2->right;
tree2->right = NULL;
if (!tree1->left) {
tree1->left = tree2;
} else {
merge(tree1->left, tree2);
}
if (right_child)
merge(tree1, right_child... 阅读全帖
d******a
发帖数: 238
50
来自主题: JobHunting版 - MS onsite 面经
http://www.algorithmist.com/index.php/Merge_sort
Bottom-up merge sort is a non-recursive variant of the merge sort, in which
the array is sorted by a sequence of passes. During each pass, the array is
divided into blocks of size . (Initially, ). Every two adjacent blocks are
merged (as in normal merge sort), and the next pass is made with a twice
larger value of .
In pseudo-code:
Input: array a[] indexed from 0 to n-1.
m = 1
while m <= n do
i = 0
while i < n-m do
merge subarrays ... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)