学编程面试通不过_我从编程面试中学到了什么

学编程面试通不过

by Edaena Salinas

由Edaena Salinas

我从编程面试中学到了什么 (What I Learned from Programming Interviews)

In 2017, I went to the Grace Hopper Celebration of women in computing. It’s the largest gathering of this kind, with 17,000 women attending last year.

2017年,我参加了计算机领域的Grace Hopper庆祝活动 。 这是此类活动中最大的聚会,去年有17,000名妇女参加。

This conference has a huge career fair where companies interview attendees. Some even get offers. Walking around the area, I noticed that some people looked stressed and worried. I overheard conversations, and some talked about how they didn’t do well in the interview.

本次会议有一个巨大的招聘会,公司在此采访与会者。 有些甚至获得报价。 我到处走走,发现有些人看起来压力和担心。 我无意间交谈,有些人谈论他们在面试中表现不好的地方。

I approached a group of people that I overheard and gave them advice. I considered some of the advice I gave to be basic, such as “it’s okay to think of the naive solution first.” But people were surprised by most of the advice I gave them.

我接触了一群我听到的人,并给了他们建议。 我认为我给出的一些建议是基本的,例如“可以先考虑天真的解决方案。” 但是人们对我给他们的大多数建议感到惊讶。

I wanted to help more people with this. I gathered a list of tips that worked for me and published a podcast episode about them. They’re also the topic of this post.

我想帮助更多的人。 我收集了对我有用的提示列表,并发布了有关这些提示的播客片段 。 它们也是本文的主题。

I’ve had many programming interviews both for internships and full-time jobs. When I was in college studying Computer Science, there was a career fair every fall semester where the first round of interviews took place. I have failed at the first and final rounds of interviews. After each interview, I reflected on what I could’ve done better and had mock up interviews with friends who gave me feedback.

我有很多关于实习和全职工作的编程访谈。 当我在大学学习计算机科学时,每个秋季学期都会举行一次招聘会,其中进行了第一轮面试。 我在面试的第一轮和最后一轮都失败了。 每次面试后,我都会反思自己可以做得更好,并与能给我反馈的朋友进行面试。

Whether we find a job through a job portal, networking, or university recruiting, part of the process involves doing a technical interview.

无论我们是通过工作门户网站,网络还是大学招聘来找到工作,过程的一部分都涉及进行技术面试。

In recent years we’ve seen different interview formats emerge:

近年来,我们看到了不同的采访形式:

  • Pair programming with an engineer

    与工程师配对编程
  • Online quiz and online coding

    在线测验和在线编码
  • Whiteboard interviews

    白板面试

I’ll focus on the whiteboard interview because it’s the one that I have experienced. I’ve had many interviews. Some of them have gone well, while others haven’t.

我将专注于白板面试,因为这是我经历过的一次。 我接受了很多采访。 其中一些进展顺利,而另一些则没有。

我做错了 (What I did wrong)

First, I want to go over the things I did wrong in my interviews. This helps see the problems and what to improve.

首先,我想回顾一下我在采访中做错的事情。 这有助于查看问题以及需要改进的地方。

When an interviewer gave me a technical problem, I immediately went to the whiteboard and started trying to solve it. Without saying a word.

当面试官给我一个技术问题时,我立即上了白板,开始尝试解决它。 一言不发。

I made two mistakes here:

我在这里犯了两个错误:

没有澄清对解决问题至关重要的信息 (Not clarifying information that is crucial to solve a problem)

For example, are we only working with numbers or also strings? Are we supporting multiple data types? If you don’t ask questions before you start working on a question, your interviewer can get the impression that you won’t ask questions before you start working on a project at their company. This is an important skill to have in the workplace. It is not like school anymore. You don’t get an assignment with all the steps detailed for you. You have to find out what those are and define them.

例如,我们只使用数字还是字符串? 我们是否支持多种数据类型? 如果在开始处理问题之前不问问题,那么面试官会给人一种印象,即在您开始在他们公司的项目中就不会提出问题。 这是在工作场所拥有的一项重要技能。 它不再像学校了。 您不会获得包含所有详细步骤的作业。 您必须找出这些是什么并定义它们。

无需写作或交流即可思考 (Thinking without writing or communicating)

Often times I stood there thinking without writing. When I was doing a mock interview with a friend, he told me that he knew I was thinking because we had worked together. To a stranger, it can seem that I’m clueless, or that I’m thinking. It is also important not to rush on a solution right away. Take some time to brainstorm ideas. Sometimes the interviewer will gladly participate in this. After all, that’s how it is at work meetings.

很多时候,我站在那儿思考而不写。 当我和一个朋友进行模拟采访时,他告诉我他知道我在想,因为我们一起工作。 在一个陌生人看来,我似乎一无所知 ,或者我在想。 同样重要的是不要立即寻求解决方案。 花一些时间集思广益。 有时候,面试官会很乐意参加。 毕竟,这就是工作会议的方式。

提出解决方案 (Coming up with a solution)

Before you begin writing code, it helps if you come up with the algorithm first. Don’t start writing code and hope that you’ll solve the problem as you write.

在开始编写代码之前,如果先提出算法,将会很有帮助。 不要开始编写代码,并希望您能在编写时解决问题。

This is what has worked for me:

这对我有用:

  1. Brainstorm

    头脑风暴
  2. Coding

    编码
  3. Error handling

    错误处理
  4. Testing

    测试中
1.头脑风暴 (1. Brainstorm)

For me, it helps to visualize first what the problem is through a series of examples. If it’s a problem related to trees, I would start with the null case, one node, two nodes, three nodes. This can help you generalize a solution.

对我而言,它有助于通过一系列示例来直观地了解问题所在。 如果这是与树有关的问题,我将从空情况开始,一个节点,两个节点,三个节点。 这可以帮助您概括解决方案。

On the whiteboard, write down a list of the things the algorithm needs to do. This way, you can find bugs and issues before writing any code. Just keep track of the time. I made a mistake once where I spent too much time asking clarifying questions and brainstorming, and I barely had time to write the code. The downside of this is that your interviewer doesn’t get to see how you code. You can also come off as if you’re trying to avoid the coding portion. It helps to wear a wrist watch, or if there’s a clock in the room, look at it occasionally. Sometimes the interviewer will tell you, “I think we have the necessary information, let’s start coding it.”

在白板上, 写下算法需要做的事情的清单 这样,您可以在编写任何代码之前发现错误和问题。 只是跟踪时间。 曾经有一次我犯了一个错误,因为我花了太多时间问问题和集思广益,而我几乎没有时间编写代码。 不利的一面是您的面试官看不到您的编码方式。 您也可以像尝试避开编码部分一样退出。 佩戴手表会很有帮助,或者如果房间里有时钟,不妨看看它。 有时,面试官会告诉您:“我认为我们有必要的信息,让我们开始进行编码。”

2.编码和代码演练 (2. Coding and code walkthrough)

If you don’t have the solution right away, it always helps to point out the obvious naive solution. While you’re explaining this, you should be thinking of how to improve it. When you state the obvious, indicate why it is not the best solution. For this it helps to be familiar with big O notation. It is okay to go over 2–3 solutions first. The interviewer sometimes guides you by saying, “Can we do better?” This can sometimes mean they are looking for a more efficient solution.

如果您没有立即解决方案,则总是可以指出显而易见的幼稚解决方案。 在解释这一点时,您应该考虑如何改进它。 当您陈述显而易见的内容时,请说明为什么它不是最佳解决方案。 为此,有助于熟悉大的O符号。 可以先解决2-3个解决方案。 面试官有时会引导您说:“我们可以做得更好吗?” 有时这可能意味着他们正在寻找更有效的解决方案。

3.错误处理 (3. Error handling)

While you’re coding, point out that you’re leaving a code comment for error handling. Once an interviewer said, “That’s a good point. How would you handle it? Would you throw an exception? Or return a specific value?” This can make for a good short discussion about code quality. Mention a few error cases. Other times, the interviewer might say that you can assume that the parameters you’re getting already passed a validation. However, it is still important to bring this up to show that you are aware of error cases and quality.

在编写代码时,请指出您将留下代码注释以进行错误处理。 一次面试官说:“这是一个好主意。 您将如何处理? 你会抛出异常吗? 还是返回特定值?” 这可以使您对代码质量进行简短的讨论。 提及一些错误情况。 在其他时候,面试官可能会说您可以假设要获取的参数已经通过验证。 但是,提出这一点以表明您知道错误情况和质量仍然很重要。

4.测试 (4. Testing)

After you have finished coding the solution, re-use the examples from brainstorming to walk through your code and make sure it works. For example you can say, “Let’s go over the example of a tree with one node, two nodes.”

完成解决方案的编码后,请重新使用集思广益的示例来遍历您的代码并确保其有效 。 例如,您可以说:“我们来看一棵有一个节点,两个节点的树的例子。”

After you finish this, the interviewer sometimes asks you how you would test your code, and what your test cases would be. I recommend that you organize your test cases in different categories.

完成此操作后,面试官有时会询问您如何测试代码以及​​测试用例是什么。 我建议您按不同类别组织测试用例。

Some examples are:

一些例子是:

  1. Performance

    性能
  2. Error cases

    错误案例
  3. Positive expected cases

    积极的预期案例

For performance, think about extreme quantities. For example, if the problem is about lists, mention that you would have a case with a large list and a really small list. If it’s about numbers, you’ll test the maximum integer number and the smallest. I recommend reading about testing software to get more ideas. My favorite book on this is How We Test Software at Microsoft.

对于性能,请考虑极端数量。 例如,如果问题是关于列表的,请提及您的案例中有一个大列表和一个非常小的列表。 如果是数字,您将测试最大整数和最小整数。 我建议阅读有关测试软件的更多信息。 我最喜欢的书是《 Microsoft如何测试软件》

For error cases, think about what is expected to fail and list those.

对于错误情况,请考虑预期会失败的原因并将其列出。

For positive expected cases, it helps to think of what the user requirements are. What are the cases that this solution is meant to solve? Those are the positive test cases.

对于预期的积极情况,有助于考虑用户需求。 该解决方案打算解决哪些情况? 这些是积极的测试案例。

“有什么要问我的问题么?” (“Do you have any questions for me?”)

Almost always there will be a few minutes dedicated at the end for you to ask questions. I recommend that you write down the questions you would ask your interviewer before the interview. Don’t say, “I don’t have any questions.” Even if you feel the interview didn’t go well, or you’re not super passionate about the company, there’s always something you can ask. It can be about what the person likes and hates most about his or her job. Or it can be something related to the person’s work, or technologies and practices used at the company. Don’t feel discouraged to ask something even if you feel you didn’t do well.

最后,几乎总是会有几分钟专门供提问。 我建议您写下面试前要问面试官的问题 。 不要说:“我没有任何问题。” 即使您觉得面试不顺利,或者您对公司不满,也总会有一些问题要问。 这可能与该人最喜欢和最讨厌自己的工作有关。 也可能与个人的工作或公司使用的技术和实践有关。 即使您觉得自己做得不好,也不要灰心问些什么。

申请工作 (Applying for a job)

As for searching and applying for a job, I’ve been told that you should only apply to a place that you would be truly passionate to work for. They say pick a company that you love, or a product that you enjoy using, and see if you can work there.

关于找工作和求职,有人告诉我,您只应申请一个您真正有工作热情的地方。 他们说选择一个您喜欢的公司或您喜欢使用的产品,然后看看您是否可以在那工作。

I don’t recommend that you always do this. You can rule out many good options this way, especially if you’re looking for an internship or an entry-level job.

我不建议您总是这样做。 您可以通过这种方式排除很多不错的选择,尤其是当您正在寻找实习或入门级工作时。

You can focus on other goals instead. What do I want to get more experience in? Is it cloud computing, web development, or artificial intelligence? When you talk to companies at the career fair, find out if their job openings are in this area. You might find a really good position at a company or a non-profit that wasn’t in your list.

您可以专注于其他目标。 我想获得更多经验吗? 是云计算,Web开发还是人工智能? 当您在招聘会上与公司交谈时,请确定他们的职位空缺是否在这一领域。 您可能会在不在列表中的公司或非营利组织中找到非常好的职位。

切换团队 (Switching teams)

After a year and a half at my first team, I decided that it was time to explore something different. I found a team I liked and had 4 rounds of interviews. I didn’t do well.

在第一支团队工作了一年半之后,我认为该是时候探索一些不同的东西了。 我找到了一个我喜欢的球队,并进行了四轮采访。 我做得不好

I didn’t practice anything, not even simply writing on a whiteboard. My logic had been, if I have been working at the company for almost 2 years, why would I need to practice? I was wrong about this. I struggled to write a solution on the whiteboard. Things like my writing being too small and running out of space by not starting at the top left all contributed to not passing.

我没有练习任何东西,甚至没有简单地在白板上书写。 我的逻辑是,如果我在公司工作了近两年,为什么我需要练习? 我错了。 我努力在白板上写一个解决方案。 诸如我的文字太小以及由于没有从左上角开始而耗尽空间之类的事情,都导致了不及格。

I hadn’t brushed up on data structures and algorithms. If I had, I would’ve been more confident. Even if you’ve been working at a company as a Software Engineer, before you do a round of interviews with another team, I strongly recommend you go through practice problems on a whiteboard.

我还没有完全了解数据结构和算法。 如果有的话,我会更加自信。 即使您曾在一家公司担任软件工程师,在与另一团队进行一轮面试之前,我也强烈建议您在白板上解决实践问题。

As for finding a team, if you are looking to switch teams at your company, it helps to talk informally with members of that team. For this, I found that almost everyone is willing to have lunch with you. People are mostly available at noon too, so there is low risk of lack of availability and meeting conflicts. This is an informal way to find out what the team is working on, and see what the personalities of your potential team members are like. You can learn many things from lunch meetings that can help you in the formal interviews.

至于寻找团队,如果您想换公司中的团队,则可以与该团队成员进行非正式交谈。 为此,我发现几乎每个人都愿意与您共进午餐。 人们也经常在中午有空,因此缺乏可用性和遇到冲突的风险很小。 这是一种非正式的方式,可以了解团队正在做什么,并查看潜在团队成员的个性。 您可以从午餐会上学到很多东西,可以帮助您进行正式面试。

It is important to know that at the end of the day, you are interviewing for a specific team. Even if you do really well, you might not get an offer because you are not a culture fit. That’s part of why I try to meet different people in the team first, but this is not always possible. Don’t get discouraged by a rejection, keep your options open, and practice.

重要的是要知道,最终,您正在为一个特定的团队进行面试。 即使您确实做得很好,您也可能无法获得要约,因为您不适合文化。 这就是为什么我首先尝试与团队中的其他人会面的部分原因,但这并不总是可能的。 不要因拒绝而灰心,保持选择的开放性并进行练习。

This content is from the “Programming interviews” episode on The Women in Tech Show: Technical Interviews with Prominent Women in Tech.

此内容摘自 科技界女性秀 ”中“编程访谈” :与科技界杰出女性的技术访谈

翻译自: https://www.freecodecamp.org/news/what-i-learned-from-programming-interviews-29ba49c9b851/

学编程面试通不过

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值