首页 > > > CareerCup.Cracking.the.Technical.Interview.Ed4.…

CareerCup.Cracking.the.Technical.Interview.Ed4.2010.pdf

CareerCup.Cracking.the.Technica…

上传者: hr21 2011-01-08 评分1 评论0 下载793 收藏10 阅读量1162 暂无简介 简介 举报

简介:本文档为《CareerCup.Cracking.the.Technical.Interview.Ed4.2010pdf》,可适用于IT书籍领域,主题内容包含tSPHSBNNJOH*OUFSWJFXVFTUJPOTBOEPMVUJPOTt'JWFSPWFO"QQSPBDIFTUPPMWJOHPVHI"MH符等。

t 1SPHSBNNJOH*OUFSWJFX2VFTUJPOTBOE4PMVUJPOT t 'JWF1SPWFO"QQSPBDIFTUP4PMWJOH5PVHI"MHPSJUIN2VFTUJPOT t 5FO.JTUBLFT$BOEJEBUFT.BLF"OE)PXUP"WPJE5IFN t 4UFQTUP1SFQBSFGPS#FIBWJPSBMBOE5FDIOJDBM2VFTUJPOT t *OUFSWJFX8BS4UPSJFT"7JFXGSPNUIF*OUFSWJFXFST4JEF (BZMF -BBLNBOO GAYLE LAAKMANN Founder and CEO, CareerCup.com 150 programming interview questions and solutions Plus: t Five proven approaches to solving tough algorithm questions t Ten mistakes candidates make -- and how to avoid them t Steps to prepare for behavioral and technical questions t Interviewer war stories: a view from the interviewer’s side FOURTH EDITIONCRACKING THE C O D I N G I N T E R V I E W CRACKING THE CODING INTERVIEW CRACKING THE C O D I N G I N T E R V I E W 150 Programming Interview Questions and Solutions GAYLE LAAKMANN Founder and CEO, CareerCup.com CareerCup, LLC Seattle, WA CRACKING THE CODING INTERVIEW, FOURTH EDITION Copyright 2008 - 2010 by Gayle Laakmann. All rights reserved. Published by CareerCup, LLC, Seattle, WA. Version 3.21090410302210. Visit our website at: www.careercup.com. No part of this book may be used or repro- duced in any manner without written permission except in the case of brief quota- tions in critical articles or reviews. For more information, contact support@careercup.com. Printed in United States of America 978-1-450-59320-5 9781450593205 (ISBN 13) Cracking the Coding Interview1 5BCMFPG$POUFOUT 'PSFXPSE 4 *OUSPEVDUJPO 5 #FIJOEUIF4DFOFT 7 The Microsoft Interview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 The Amazon Interview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 The Google Interview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 The Apple Interview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 The Yahoo Interview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 *OUFSWJFX8BS4UPSJFT 13 #FGPSFUIF*OUFSWJFX 20 Resume Advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Behavioral Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Technical Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5IF*OUFSWJFXBOE#FZPOE 28 Handling Behavioral Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Handling Technical Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Five Algorithm Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 The Offer and Beyond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Top Ten Mistakes Candidates Make. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 *OUFSWJFX2VFTUJPOT 44 %BUB4USVDUVSFT 46 Chapter 1 | Arrays and Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Chapter 2 | Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Chapter 3 | Stacks and Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Chapter 4 | Trees and Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 $PODFQUTBOE"MHPSJUINT 56 Chapter 5 | Bit Manipulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Chapter 6 | Brain Teasers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 2CareerCup.com 5BCMFPG$POUFOUT Chapter 7 | Object Oriented Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Chapter 8 | Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Chapter 9 | Sorting and Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Chapter 10 | Mathematical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Chapter 11 | Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Chapter 12 | System Design and Memory Limits . . . . . . . . . . . . . . . . . . . . . . . . . 71 ,OPXMFEHF#BTFE 74 Chapter 13 | C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Chapter 14 | Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Chapter 15 | Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Chapter 16 | Low Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Chapter 17 | Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Chapter 18 | Threads and Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 "EEJUJPOBM3FWJFX1SPCMFNT 88 Chapter 19 | Moderate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Chapter 20 | Hard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 4PMVUJPOT 94 *OEFY 301 .PDL*OUFSWJFXT 303 "CPVUUIF"VUIPS 304 4CareerCup.com 'PSFXPSE Dear Readers, Welcome to the 4th edition of Cracking the Coding Interview. This volume updates the 3rd edition with new content and refreshed information. Be sure to check out our website, www. careercup.com, to connect with other candidates and to discover new resources. For those of you new to technical interviews, the process can seem overwhelming. Inter- viewers throw questions at you, expect you to whip up brilliant algorithms on the spot, and then ask you to write beautiful code on a whiteboard. Luckily, everyone else is in the same boat, and you’re already working hard to prepare. Good job! As you get ready for your interviews, consider these suggestions: 8SJUF$PEFPO1BQFSMost interviewers won’t give you a computer and will instead expect you to write code on a whiteboard or on paper. To simulate this environment, try answering interview problems by writing code on paper !rst, and then typing them into a computer as-is. Whiteboard / paper coding is a special skill, which can be mastered with constant practice. ,OPX:PVS3FTVNFWhile technical skills are extremely important, that’s no reason to neglect your own resume. Make sure to prepare yourself to give a quick summary of any project or job you were involved with, and to discuss the hardest and most interesting problems you encountered along the day. %POU.FNPSJ[F4PMVUJPOTWhile this book o$ers a representative sample of interview questions, there are still thousands of interview questions out there. Memorizing solu- tions is not a great use of your time. Rather, use this book to explore approaches to problems, to learn new concepts, and to practice your skills. 5BML0VU-PVE Interviewers want to understand how you think and approach prob- lems, so talk out loud while you’re solving problems. Let the interviewer see how you’re tackling the problem, and they just might guide you as well. "OESFNFNCFSJOUFSWJFXTBSFIBSEIn my years of interviewing at Google, I saw some interviewers ask “easy” questions while others ask harder questions. But you know what? Getting the easy questions doesn’t make it any easier to get the o$er. Receiving an o$er is not about solving questions "awlessly (very few candidates do!), but rather, it is about answering questions better than other candidates. So don’t stress out when you get a tricky question - everyone else probably thought it was hard too! I'm excited for you and for the skills you are going to develop. Thorough preparation will give you a wide range of technical and communication skills. It will be well-worth it no matter where the e$ort takes you! Study hard, practice, and good luck! Gayle Laakmann Cracking the Coding Interview5 *OUSPEVDUJPO 4PNFUIJOHT8SPOH We walked out of the hiring meeting frustrated, again. Of the ten “passable” candidates we reviewed that day, none would receive o$ers. Were we being too harsh, we wondered? I, in particular, was disappointed. We had rejected one of my candidates. A former student. One who I had referred. He had a 3.73 GPA from the University of Washington, one of the best computer science schools in the world, and had done extensive work on open source projects. He was energetic. He was creative. He worked hard. He was sharp. He was a true geek, in all the best ways. But, I had to agree with the rest of the committee: the data wasn’t there. Even if my emphatic recommendation would sway them to reconsider, he would surely get rejected in the later stages of the hiring process. There were just too many red "ags. Though the interviewers generally believed that he was quite intelligent, he had struggled to develop good algorithms. Most successful candidates could "y through the !rst ques- tion, which was a twist on a well known problem, but he struggled to develop his algorithm. When he came up with one, he failed to consider solutions that optimized for other scenar- ios. Finally, when he began coding, he "ew through the code with an initial solution, but it was riddled with mistakes that he then failed to catch. Though he wasn’t the worst candidate we'd seen by any measure, he was far from meeting “the bar.” Rejected. When he asked for feedback over the phone a couple of weeks later, I struggled with what to tell him. Be smarter? No, I knew he was brilliant. Be a better coder? No, his skills were on-par with some of the best I'd seen. Like many motivated candidates, he had prepared extensively. He had read K&R’s classic C book and he'd reviewed CLRS' famous algorithms textbook. He could describe in detail the myriad of ways of balancing a tree, and he could do things in C that no sane programmer should ever want to do. I had to tell him the unfortunate truth: those books aren’t enough. Academic books prepare you for fancy research, but they’re not going to help you much in an interview. Why? I'll give you a hint: your interviewers haven’t seen Red-Black Trees since they were in school either. To crack the coding interview, you need to prepare with real interview questions. You must practice on real problems, and learn their patterns. Cracking the Coding Interview is the result of my !rst-hand experience interviewing at top companies. It is the result of hundreds of conversations with candidates. It is the result of the thousands of candidate- and interviewer- contributed questions. And it’s the result of seeing so many interview questions from so many !rms. Enclosed in this book are 150 of the best interview questions, selected from thousands of potential problems. 6CareerCup.com *OUSPEVDUJPO .Z"QQSPBDI The focus of Cracking the Coding Interview is algorithm, coding and design questions. Why? Because while you can and will be asked behavioral questions, the answers will be as varied as your resume. Likewise, while many !rms will ask so-called “trivia” questions (e.g., “What is a virtual function?”), the skills developed through practicing these questions are limited to very speci!c bits of knowledge. The book will brie"y touch on some of these questions, to show you what they’re like, but I have chosen to allocate space where there’s more to learn. .Z1BTTJPO Teaching is my passion. I love helping people understand new concepts, and giving them tools so that they can excel in their passions. My !rst experience “o%cially” teaching was in college at the University of Pennsylvania, when I became a teaching assistant for an undergraduate Computer Science course during my second year. I went on to TA for several other courses, and eventually launched my own CS course at the university focused on “hands-on” skills. As an engineer at Google, training and mentoring “Nooglers” (yes, that’s really what they call new Google employees!) were some of the things I enjoyed most. I went on to use my “20% time” to teach two Computer Science courses at the University of Washington. Cracking the Coding Interview and $BSFFS$VQDPN re"ect my passion for teaching. Even now, you can often !nd me “hanging out” at CareerCup.com, helping users who stop by for assistance. Join us. Gayle Laakmann Cracking the Coding Interview7 #FIJOEUIF4DFOFT For many candidates, interviewing is a bit of a black box. You walk in, you get pounded with questions from a variety of interviewers, and then somehow or other you return with an of- fer... or not. Have you ever wondered: How do decisions get made? Do your interviewers talk to each other? What does the company really care about? Well, wonder no more! CareerCup sought out interviewing experts from !ve top companies - Microsoft, Google, Amazon, Yahoo and Apple - to show you what really happens “behind the scenes.” These experts will walk us through a typical interview day and describe what’s taking place outside of the interviewing room, and what happens after you leave. Our interviewing experts also told us what’s di$erent about their interview process. From bar raisers (Amazon) to Hiring Committees (Google), each company has its own quirks. Knowing these idiosyncrasies will help you to react better to a super-tough interviewer, or to avoid being intimidated when two interviewers show up at the door (Apple!). In addition, our specialists o$ered insight as to what their company stresses in their inter- views. While almost all software !rms care about coding and algorithms, some companies focus more than others on speci!c aspects of the interview. Whether this is because of the company’s technology or its history, now you'll know what and how to prepare. So, join us as we take you behind the scenes at Microsoft, Google, Amazon, Yahoo and Ap- ple... 8CareerCup.com #FIJOEUIF4DFOFT]The Microsoft Interview Microsoft wants smart people. Geeks. People who are passionate about technology. You probably won’t be tested on the ins and outs of C++ APIs, but you will be expected to write code on the board. In a typical interview, you'll show up at Microsoft at some time in the morning and !ll out initial paper work. You'll have a short interview with a recruiter where he or she will give you a sample question. Your recruiter is usually there to prep you, and not to grill you on techni- cal questions. Be nice to your recruiter. Your recruiter can be your biggest advocate, even pushing to re-interview you if you stumbled on your !rst interview. They can !ght for you to be hired - or not! During the day, you'll do four or !ve interviews, often with two di$erent teams. Unlike many companies, where you meet your interviewers in a conference room, you'll meet with your Microsoft interviewers in their o%ce. This is a great time to look around and get a feel for the team culture. Depending on the team, interviewers may or may not share their feedback on you with the rest of the interview loop. When you complete your interviews with a team, you might speak with a hiring manager. If so, that’s a great sign! It likely means that you passed the interviews with a particular team. It’s now down to the hiring manager’s decision. You might get a decision that day, or it might be a week. After one week of no word from HR, send them a friendly email asking for a status update. De nitely Prepare: “Why do you want to work for Microsoft?” In this question, Microsoft wants to see that you’re passionate about technology. A great answer might be, “I’ve been using Microsoft software as long as I can re- member, and I'm really impressed at how Microsoft manages to create a product that is universally excellent. For example, I’ve been using Visual Studio recently to learn game programming, and it’s APIs are excellent.” Note how this shows a passion for technology! What’s Unique: You'll only reach the hiring manager if you’ve done well, but if you do, that’s a great sign! Cracking the Coding Interview9 #FIJOEUIF4DFOFT]The Amazon Interview Amazon’s recruiting process usually begins with one or two phone screens in which you in- terview with a speci!c team. The engineer who interviews you will usually ask you to write simple code and read it aloud on the phone. They will ask a broad set of questions to explore what areas of technology you’re familiar with. Next, you "y to Seattle for four or !ve interviews with one or two teams which have selected you based on your resume and phone interviews. You will have to code on a whiteboard, and some interviewers will stress other skills. Interviewers are each assigned a speci!c area to probe and may seem very di$

编辑推荐

  • 名称/格式
  • 评分
  • 下载次数
  • 资料大小
  • 上传时间

用户评论

0/200
    暂无评论
上传我的资料

相关资料

资料评价:

/ 310
所需积分:1 立即下载
返回
顶部
举报
资料
关闭

温馨提示

感谢您对爱问共享资料的支持,精彩活动将尽快为您呈现,敬请期待!