2008年11月28日星期五

百度求职记

  百度应当是我第二家参加面试的公司。这家公司很早就投了,那时候一个同学发了一个内部推荐的消息。知道这家公司现在境况不错,待遇也很好,于是赶紧联系了同学,帮忙向他们部门进行推荐。于是乎,还为了百度做了一些准备,复习了数据结构,复习了算法……

  他们是10月20号左右来到了交大。笔试当天的上午被叫过去,与我同学相应部门的招聘人员进行了一次面试。一进门,没有两句话,就是写程序,写一个多路归并排序,当时不习惯于在纸上写程序,因为没有时间给你细想,不细想的后果是极容易写错,写错的后果是前面会被改的乱七八糟,以至于没有地方写下要写的东西,反正本人到现在也不习惯这种方式(但是有人就能搞的定,说明自己还是有不足)。在一阵乱涂乱抹之后,思路也像纸上的字一样,被乱涂乱抹了,于是乎,偷了个懒,写了一个二路归并的程序,然后在主程序之中每次两个归并段的归并,于是把程序交给面试官。偷懒是要付出代价的,结果就是,比较多路平衡归并和我这种两两不平衡归并的差别,比较优劣。结果又是有些慌乱,虽然最后说出了他期待的答案,但在找到这个答案之前犯下的错误有一次预示这解决的悲剧性……

  搞完这个题目后,面试官又招呼我另外一个题目:一个函数,以p的概率产生0,以1-p的概率产生1,p不等于0.5,写一个函数仅使用上一个函数及三种基本程序设计结构(别跟我说自己写个随机数生成函数……),以0.5的概率产生1,以0.5的概率产生0。当时就一个感觉——见过这题,然后就是第二个感觉——没见过答案。于是乎,开始了苦苦的思索,结果是悲剧——没有找到答案,过程中还犯了一些错误。于是乎,在经过20多分钟的挣扎后,放弃了努力,后来闲扯几句,这次面试就结束了,临走时问了面试官概率题的答案,知道答案后愤懑不已。

  出来后,清醒了一下,觉得自己怎么这么迟钝,为什么不在10分钟的时候放弃这道题,换一道题目不久完了,纠缠这道题的后果就是自己没有展示出该展示的东西。

  当天晚上百度笔试,虽然觉得结局依然注定,还是去参加了笔试。DB同学也从复旦赶来,说是第一次没笔好,再试一次。笔试题目是难的。第一题,给定若干基本操作,然后实现加减乘除运算。貌似给的操作对于实现加减乘除是足够完备的了,但是实在是不方便,束手束脚。第二题,C++程序设计,给了一段程序改错,非常细节,比照往年的题目,虽然也有C++试题,但没有细节到这种程度,本人现在JAVA流派,结局可想而知,最后一道题目应该是开放式的,一个XXX系统,访问量巨大,数据量巨大,机器巨多,设计一个带缓存的分布式系统满足这个巨BT的系统,对于我们大多数没有接触过这种BT三巨系统的人来说,对策就是一个,尽其所能,云里雾里的乱写一气。

  笔试后的感受一如既往的不好,最后的结果也是预期的——悲剧。
最后,感谢同学的推荐,感谢中间帮助过我的人,祝愿我在百度的同学们工作顺利,生活愉快,百度很累,注意身体。

附:有想知道那个概率题目答案的先自己想,然后去搜,搜不到了联系我 :)

待续:华为求职记

微软求职记

  10月12号,我参加了微软的第一场全国笔试。微软的笔试不容易,前面全部是选择题,有一定深度和广度。最后有一道程序设计题,题目比较老套,好像是文件中取很多记录,取频率最高的n个。由于这种笔试一般都会要求保密,虽然记不清楚微软要不要保密,但是一来我记不清楚题目的细节,二来还是按常理,给微软个人情,不写题目细节了。和很多大的跨国企业一样,笔试有个比较BT的规矩,就是打错要扣分,目的就是防止有人蒙,所以这种考试搞不好有可能是负分。笔试当天,微软估计没有预料到教育网和他们的网站的连接没有他们想像中的好,所有人一起开始答题时,系统瘫痪了,结果做了两三道题之后,大家换了纸质的试卷开始答,答完题目之后感觉不好,听天由命了。

  就在自己对ms不报什希望的时候,面试却来了。记不得微软的面试是不是自己面的第一家了,反正不是它就是百度。大概10月18号左右,电话通知我到衡山路的XXX富豪酒店面试,微软STC部门。一看名字有点怪异,怎么微软的人会找这么俗气名字的酒店。微软招聘和别人不太一样就是没有具体的方向让你选,网投的时候只能选择自己的兴趣,然后他们会根据你的兴趣和特长为你分配部门。在面试的前一天(或是两天),微软在交大有个Round Table Meeting。我被邀请过去参加,以为能有什么关于面试的信息,结果就是微软各部门员工和我们座谈,虽说没有得到最想要的信息,却知道了微软员工的一些感受和想法,也挺好。晚上微软宣讲会,说是有个模拟面试的环节,后来真正面了才知道,那还真是"模拟",和我面的内容差的那叫一个远……

  我的面试时间是早上8点,结果要起个大早,好像那天我是6点起来的(或者是5点半)。8点钟开始了面试,我投的是SDE职位,本该是一个 Dev来面我,结果后来知道当时计划面我的人去面另一个,换了一个PM来面。先是简单的英文自我介绍,貌似我介绍的时候他还在看我的简历,然后问了两个英文的Open Question,经典题目:职业规划,找工作看重的东西。这些完了,就是真正的干货了,写程序。由于没有被要求对面试内容保密(这个我确定,一定以及肯定),所以说说那个题目:一个文本文件,里面会有一些阿拉伯数字形式的number,比如145,-34,1.89等,写个程序使其他字符不变,这些数字全部转为中文形式,如145转为"一百四十五",-34转为"负三十四",1.89转为"一点八九"。这一轮面试总共一个小时,在写程序之前大概过去了 25分钟左右,而写完程序之后大概又被那个人面了几分钟的open question。因此,大概有半个小时时间来写这个程序,有兴趣的可以试写一下,个人觉得这个时间写这样一个程序还是很有挑战性的。而且不能只是写一个框架,因为很不幸,当时间差不多的时候,面试官会开始看你的程序,会无情的对你说"看这里,看这里,看那里,哇塞,都是bug耶"。一面结束后,紧接着就是二面。

  二面的面试官很好(我和他也颇有渊源,这个后面再说)。先是就着简历上面的科研经历问了问题,其中我说道课题中用了中科院的分词程序,他反问我,难道实验室没有分词程序么?我答曰:实验室的是c++版的,我需要JAVA版的。当时心里就一动,这个人怎么好像对我实验室有些理解似的。问完了这些,还是一样,写程序,第一个程序是LCS,最大公共字串,由于之前复习过,心想正中下怀,不就是DP么,结果拿起笔就开写,那个面试官还关心的问了一句:"你知道什么事LCS问题吧,我怕你走错了方向",我答曰:知道……。结果写了一会儿才发现,自己还是把题目搞错了,两个串的LCS不是最常的连续公共字串!!!结果后来就有点儿慌了,虽然在面试官的帮助下,搞清了题目,写出了DP的递归表达式,但是这个表现还是预示了最后的悲剧结果。然后换了另外一个题目:交换一个链表的相邻的奇偶节点,就是1,2节点交换,3,4交换,余类推,是节点交换,而不是仅交换内容(其实类似)。还是一贯ms的要求,特殊情况和边界情况要考虑全面。由于前面耽误的时间较多,后面这个题目也没来得及写完,一个小时的面试时间就到了……

  过了一会儿被告知,可以回去了,等消息。我知道这是悲剧的信号,因为来之前hr就告诉我,如果面的好,当天有三轮面试。于是打包回了学校,心里倒也没有太多沮丧,又能怎么样呢,是自己表现的不好,人家给了机会没把握住。如果说当时有遗憾,那就是没能吃到微软提供的午饭,五星级酒店的自助餐,据说如果有三面的话,是下午,中午会有午饭……,错过了一次免费午餐的机会。

  和微软没有缘分,微软求职就这样结束了。这里要提一下的就是这次面试中我和二面面试官的渊源。前段时间计算机系50周年系庆,刘师兄发来了一封邮件,而我在那封邮件里看到了一个熟悉的名字——那个二面的面试官,我隐约觉得那个人应该也是我的师兄,我立刻问了发邮件的刘师兄,得到了肯定的答复,那个人和他一届,就是我们实验室出来的。于是乎回想出面试的种种,找到了这个人对我格外耐心的原因,心中充满了感激和愧疚,感激是罗师兄尽了自己的最大努力对师弟照顾,愧疚是我辜负了师兄的照顾。于是乎,写了一封邮件,表达了对罗师兄的感谢之情,罗师兄回复中也道出了我失败的原因:给人的感觉是基础不十分扎实。这是上大学以来第一次得到这样的评价,看来自己有值得反思的地方。心中罗师兄还鼓励我继续努力,说他也不是第一次就进了ms。无论如何,感谢这个过程中我知道的和我不知道的像罗师兄这样帮助过我的人……

  微软面完还有一个感受,也是很多过来人的感受——不要把你看重的企业放到第一个去面试,那样失败的概率很高。不过无奈是的这些大企业每年都是"手忒快",没有比他们更早的企业了,所以,要自己想办法练习,模拟面试。另外就是平时要努力,因为没有实力,只有面试技巧,你会发现你没机会用你的技巧,没有实力支撑,面试技巧就是一坨X……

待续:百度求职记。

2008年11月23日星期日

Steve Jobs' Commencement Address

This is the text of the Commencement address by Steve Jobs, CEO of Apple Computer and of Pixar Animation Studios, delivered on June 12, 2005.

I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest I've ever gotten to a college graduation. Today I want to tell you three stories from my life. That's it. No big deal. Just three stories.

The first story is about connecting the dots.

I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?

It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: "We have an unexpected baby boy; do you want him?" They said: "Of course." My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college.

And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents' savings were being spent on my college tuition. After six months, I couldn't see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life. So I decided to drop out and trust that it would all work out OK. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didn't interest me, and begin dropping in on the ones that looked interesting.

It wasn't all romantic. I didn't have a dorm room, so I slept on the floor in friends' rooms, I returned coke bottles for the 5¢ deposits to buy food with, and I would walk the 7 miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:

Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didn't have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science can't capture, and I found it fascinating.

None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the Mac would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, its likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on this calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards ten years later.

Again, you can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something — your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life.

My second story is about love and loss.

I was lucky — I found what I loved to do early in life. Woz and I started Apple in my parents garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a $2 billion company with over 4000 employees. We had just released our finest creation — the Macintosh — a year earlier, and I had just turned 30. And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. So at 30 I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.

I really didn't know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down - that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me — I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.

I didn't see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.

During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the worlds first computer animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, I returned to Apple, and the technology we developed at NeXT is at the heart of Apple's current renaissance. And Laurene and I have a wonderful family together.

I'm pretty sure none of this would have happened if I hadn't been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometimes life hits you in the head with a brick. Don't lose faith. I'm convinced that the only thing that kept me going was that I loved what I did. You've got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

My third story is about death.

When I was 17, I read a quote that went something like: "If you live each day as if it was your last, someday you'll most certainly be right." It made an impression on me, and since then, for the past 33 years, I have looked in the mirror every morning and asked myself: "If today were the last day of my life, would I want to do what I am about to do today?" And whenever the answer has been "No" for too many days in a row, I know I need to change something.

Remembering that I'll be dead soon is the most important tool I've ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure - these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.

About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didn't even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctor's code for prepare to die. It means to try to tell your kids everything you thought you'd have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.

I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach and into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and I'm fine now.

This was the closest I've been to facing death, and I hope its the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept:

No one wants to die. Even people who want to go to heaven don't want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It is Life's change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it is quite true.

Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma — which is living with the results of other people's thinking. Don't let the noise of others' opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.

When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the bibles of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 1960's, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along: it was idealistic, and overflowing with neat tools and great notions.

Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: "Stay Hungry. Stay Foolish." It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I have always wished that for myself. And now, as you graduate to begin anew, I wish that for you.

Stay Hungry. Stay Foolish.

Thank you all very much.