编程面试中需要了解的5件事

This article is intended for those who are trying to start their programming career, or are preparing to interview for their dream job. As someone who’s been on both sides of the interviewing table, I understand how it feels to be the interviewee.

本文适用于那些试图开始其编程职业或者准备为他们的理想工作进行面试的人。 作为面试双方的人 ,我了解成为受访者的感觉。

This non-exhaustive list of questions floated through my mind all the time.

这个无穷尽的问题清单一直浮现在我的脑海。

  • “Am I supposed to talk through my code?”

    “我应该讲讲我的代码吗?”
  • “How often should I communicate with the interviewer?”

    “我应该多久与面试官沟通一次?”
  • “Oh god, I forgot to instantiate my variable! Am I doomed?!”

    “天哪,我忘了实例化变量! 我注定要死吗?!”
  • “What does the interviewer think of my answer?”

    “面试官对我的回答有何看法?”
  • “Is it OK if I do this?”

    “如果我这样做可以吗?”

… And the list goes on…

… 而这样的例子不胜枚举…

It is a very scary experience. It is very difficult. And it is extremely hard to operate within this vacuum when you’re being scrutinized for every single thing you say and every thing you write.

这是一个非常可怕的经历。 这非常困难。 当您仔细检查您所说的每句话和编写的每件事时,要在这种真空中进行操作都非常困难。

You’re interviewing for your dream job, something you’ve dreamed of since you were 12. And it all comes down to impressing someone you’ve never met within 60 minutes.

您正在为自己梦dream以求的工作进行面试,这是您从12岁起就梦dream以求的事情,而这一切都会给您留下深刻印象,让您在60分钟内从未遇到过。

The struggle is real.

奋斗 是真实的。

1.永远思考 (1. Always think ahead)

Often, you’ll hear an interviewer ask this: “OK, I think that looks good. Now, how would you improve this code?”

通常,您会听到一个面试官问这个问题:“好的,我认为这看起来不错。 现在,您将如何改进此代码?”

This is a killer question. And this is because it isn’t just a filler to pass time. The interviewer is trying to assess how you think about:

这是一个致命的问题 。 这是因为它不仅仅是时间的补充。 面试官正在尝试评估您的想法:

  • code quality

    代码质量
  • some concerns/bottlenecks that weren’t raised in the algorithm planning session

    算法规划会议中未提出的一些关注/瓶颈
  • how you would scale the solution at hand.

    您如何扩展手头的解决方案。

Just because you solved the problem doesn’t mean you’ll automatically get an offer.

仅仅因为您解决了问题,并不意味着您会自动获得要约。

For example, when you look at this piece of code below, what does it do? How would you improve it? What might cause it to break?

例如,当您查看下面的这段代码时,它有什么作用? 您将如何改善? 是什么导致它破裂?

Let me know in the comments below. I’d love to hear your thoughts.

在下面的评论中让我知道。 我很想听听您的想法。

Surprise?: Being able to come up with a working solution is the bare minimum to be considered for the position. These questions are basic competency tests. What separates the good candidates from great is the ability to think beyond what’s required.

惊喜?:能够提出一个可行的解决方案是该职位的最低要求。 牛逼 HESE问题是基本能力测试。 优秀候选人与优秀候选人的区别在于思考能力超出了要求。

在编码会话中这意味着什么 (What this means in a coding session)

Think about edge cases, scaling issues, problem areas. Always think one step ahead. If you’re using a recursive approach, what would happen if you have a large data set? If you’re using a hashing algorithm, how do you handle collisions? How likely is that to happen, and what’s the worst case scenario?

考虑一下极端情况,扩展问题,问题领域。 总是想向前一步。 如果您使用的是递归方法,那么如果您的数据集很大,会发生什么? 如果您使用的是哈希算法,那么如何处理冲突? 这发生的可能性有多大?最坏的情况是什么?

2.答案不只一个 (2. There’s more than one answer)

There is always more than one way to solve a programming interview problem. Always. There are usually multiple ways of tackling a problem, some of which might not be optimal.

解决编程面试问题总是有不止一种方法。 总是 。 通常有多种解决问题的方法,其中有些可能不是最佳方法。

One of my favorite tech Youtubers taught me that a coding interview is a mental exercise to see how a candidate thinks. From an interviewer perspective, I’m not looking to check if you know what the right answer is. Yes, it is important that you can write a working solution, but it’s not the only thing.

我最喜欢的一项技术,Youtubers告诉我,编码面试是一种心理锻炼,旨在了解候选人的想法。 从采访者的角度来看,我不是要检查您是否知道正确的答案。 是的,您可以编写一个有效的解决方案很重要,但这不是唯一的事情。

More than that, I’m looking for how smart this person is, how the solution is derived, and what other creative solutions this person might be thinking about.

不仅如此,我还在寻找这个人有多聪明,解决方案是如何派生的,以及这个人可能在想什么其他创造性的解决方案。

A programming exercise to illustrate my point:

一个编程练习来说明我的观点:

Merge two sorted linked lists. (It’s linked to Leetcode if you’d like to try solving). Basically you can tackle this in several ways:

合并两个排序的链表 。 (如果您想尝试解决,它链接到Leetcode)。 基本上,您可以通过几种方式解决此问题:

  1. Put all the nodes into an array and then sort it. Then, create a pointer and link every element in the array together.

    将所有节点放入数组,然后对其进行排序。 然后,创建一个指针并将数组中的每个元素链接在一起。
  2. Merge them using pointer manipulation. Compare the two, keeping track of which is smaller, and then return the results at the end.

    使用指针操作合并它们。 比较两个,跟踪较小的两个,然后最后返回结果。

What other ways can you think of?

您还能想到什么其他方式?

3. OOP还没有死 (3. OOP is not dead)

Object-oriented programming is not dead. It’s a love-hate relationship for some people, yet it’s a valuable skill to have. This is one of the fundamental skills — a programming technique every programmer should know.

面向对象的编程还没有结束。 对某些人来说,这是一种爱恨交加的关系,但拥有却是一项宝贵的技能。 这是基本技能之一,这是每个程序员都应该知道的编程技术。

Many candidates jump head-first into a programming problem without putting further thought into simplifying the code. I used to be in this bunch and, admittedly, I still do it sometimes.

许多候选人没有解决简化代码的问题就直接进入编程问题。 我曾经是一群人,但坦率地说,我有时还是这样做。

However, the ability to turn complex problems into simpler, manageable chunks by object-oriented programming is a rare and treasured skill.

但是,通过面向对象的编程将复杂的问题转换为更简单,可管理的块的能力是一种罕见且宝贵的技能。

Writing code for computers to understand is easy. Writing code for humans is hard.

编写代码让计算机易于理解。 为人类编写代码很难。

4.制作简历 (4. Craft your résumé)

Imagine you’re heading to prom night with the person of your dreams, and you show up at their doorstep in flip flops and a sleeveless t-shirt.

想象一下,您将与自己梦person以求的人一起参加舞会之夜,并且穿着拖鞋和无袖T恤出现在他们家门口。

Your résumé is your business card. It’s the company’s first impression of you.

您的简历就是您的名片。 这是公司对您的第一印象。

If you’re starting out on your job search, then the very first thing you should do is prepare a great résumé. That’s the number one thing that is often overlooked by job seekers and, arguably, is the lowest hanging fruit.

如果您正在寻找工作,那么您应该做的第一件事就是准备一份不错的简历 。 这求职者经常忽略第一件事,并且可以说是悬念最少的事情

I see a lot of candidates who spent weeks, if not months, preparing for coding interviews. But the time they spent on crafting their résumé pales in comparison.

我看到很多候选人花了数周甚至数月的时间准备面试。 但是相比之下,他们花在编写简历上的时间却相形见pale。

5.尽早沟通并经常沟通 (5. Communicate early and communicate often)

When I first started interviewing, I was erring on the side of over-communicating. This meant I was trying to talk through every single line of code I was writing, even if it was a simple for-loop.

当我第一次开始面试时,我有点过分交流 这意味着我试图遍历正在编写的每一行代码,即使这是一个简单的for循环。

I’m not the type who is able to talk and think at the same time. Some people are gifted in the way that they’re able to think out loud, but I can’t.

我不是那种能够同时讲话和思考的人。 有些人有天赋的能力,他们能够大声思考,但我不能。

Communicate as often as you need. I tried to communicate early and often. Whenever there was an issue, I would raise it with the interviewer and let them know. It helped me determine if I was heading in the right direction, and course-correct if I was not.

根据需要进行交流 。 我试图尽早和经常交流。 每当有问题时,我都会向面试官提出,并告知他们。 它帮助我确定我是否朝着正确的方向前进,如果我没有朝正确的方向前进,则可以正确地进行。

A programming interview is looking for both hard and soft skills. Lacking one or the other means a definite no. For further information, I wrote a more detailed article about how improve a software engineer’s soft skills here.

编程采访正在寻找硬技能软技能。 缺少一个意味着另一个。 如需进一步信息,我写了一篇关于如何提高软件工程师的软技能更详细的文章在这里

Don’t pressure yourself into talking through every single line of code. If you’re using some esoteric features of a programming language, you can explain it once you’re done writing the whole thing.

不要强迫自己遍历每一行代码。 如果您正在使用某种编程语言的深奥特性,那么在编写完全部内容之后就可以对其进行解释。

在编码会话中这意味着什么 (What this means in a coding session)

If you have already established some way of solving the problem, then you can just politely let the interviewer know that you’ll be diving deep into writing the code. Don’t feel that you need to explain every single line of code.

如果您已经建立了解决问题的方法,则可以礼貌地让面试官知道您将深入研究代码。 不必觉得您需要解释每一行代码。

6. [额外]使用抽象 (6. [Extra] Use abstraction)

Here’s another extra tip I picked up that helped tremendously when I was interviewing: use abstraction for complex methods.

这是我在面试时获得的另一条非常有用的技巧: 将抽象用于复杂的方法。

Using abstraction to hide the complicated implementation details doesn’t mean that you’re shoving the dirty details under the rug. It means that you understand less is more. Remember, you are writing code for humans to understand. Showing good judgement here will definitely earn you extra brownie points with the interviewer.

使用抽象来隐藏复杂的实现细节并不意味着您将肮脏的细节推到了地毯下。 这意味着您了解的少即是多。 请记住,您正在编写供人类理解的代码。 在这里表现出良好的判断力,一定会与面试官一起获得额外的布朗尼积分。

在编码会话中这意味着什么 (What this means in a coding session)

Let’s compare and contrast these two pieces of code:

让我们比较和对比这两段代码:

In my opinion, I think the right side looks much cleaner, and much easier to understand. I can then take the time to implement getNeighbors, or isEmpty, depending on what is requested of me.

我认为,右侧看起来更清洁,更容易理解。 然后,我可以花一些时间实现getNeighborsisEmpty ,具体取决于我的要求。

The important thing here is that abstraction has now helped keep my code clean, easy to read, and easy to understand. Who doesn’t like to have their cake and eat it too?

这里重要的是,现在抽象已使我的代码保持整洁,易于阅读和易于理解。 谁不喜欢吃蛋糕呢?

我为什么要分享我的经验? (Why do I want to share my experience?)

I’ve somehow miraculously managed to overcome the obstacles and find my way to my dream job. This is by no means my way of bragging. It is not my intention at all.

我以某种方式奇迹般地设法克服了障碍,并找到了自己梦想的工作之路。 这绝不是我吹牛的方式。 这根本不是我的意图。

I truly want to help others like me who are struggling to land their dream job. I’ve been through it. I understand the hardship, the sweat and tears of preparing for a programming interview. I believe that the world isn’t a zero-sum game — the more people who do better in life, the better our society becomes, and the more prosperous we’ll all be as a result of that. It’s a win-win situation.

我真的想帮助像我这样的努力工作的其他人。 我经历过了。 我了解准备参加编程面试的艰辛,汗水和眼泪。 我相信世界不是一场零和游戏-生活水平提高的人越多,我们的社会就会变得越好,因此,我们所有人都会越富裕。 这是双赢的局面。

Hopefully these tips are able to help another job seeker out there! Good luck! ?

希望这些技巧能够帮助其他求职者! 祝好运! ?

If you enjoyed this article, here are a few more recommended articles I wrote:

如果您喜欢本文,这里还有我写的一些推荐文章:

我推荐的资源和工具 (Resources and tools I recommend)

  • Elements of Programming Interviews: Great for more difficult coding problems

    编程面试的要素 :适用于更困难的编码问题

  • Cracking The Coding Interview: Great for covering foundational CS

    破解编码面试 :非常适合覆盖基础CS

  • OneNote: I use this to store all code snippets

    OneNote :我用它来存储所有代码片段

  • Evernote: For everything else

    印象笔记 :其他

  • CodeRunner: I love this Mac app! I used this multiple times to run ad-hoc Python scripts/functions and it just works amazingly well. ?

    CodeRunner :我喜欢这个Mac应用程序! 我多次使用它来运行特定的Python脚本/函数,并且效果非常好。 ?

  • Jobscan: A friend runs this company. I’ve heard many cool things about it, and you should try them out for their résumé screening tool.

    Jobscan :一位朋友经营这家公司。 我听说过很多很棒的事情,您应该尝试使用他们的简历筛选工具。

  • Refdash: Run by a bunch of ex-Googlers. The quality of mock interviews here is ?. The interviewers are ex-Googlers. I highly recommend trying them out.

    Refdash :由一群前Google员工经营。 这里的模拟面试质量为?。 面试官是前Google员工。 我强烈建议您尝试一下。

  • CodePath: A non-profit org that helps people prepare for a career in tech. Nathan and Tim are great people and I have learned a lot from them. The community is very helpful and everyone is willing to give a hand.

    CodePath :一个非盈利性组织,可以帮助人们为从事技术职业做准备。 内森(Nathan)和蒂姆(Tim)都是很棒的人,我从他们身上学到了很多东西。 社区非常有帮助,每个人都愿意伸出援手。

  • Fine-point markers: Bring these to your interview. I highly recommend them!

    重点标记 :将它们带入您的面试。 我强烈推荐他们!

Zhia Chong is a software engineer at Twitter. He works on the Ads Measurement team in Seattle, measuring ads impact and ROI for advertisers.

Zhia Chong是Twitter的软件工程师。 他在西雅图的广告衡量团队工作,为广告客户衡量广告影响和投资回报率。

You can find him on Twitter and LinkedIn.

您可以在TwitterLinkedIn上找到他。

翻译自: https://www.freecodecamp.org/news/the-most-important-things-you-need-to-know-for-a-programming-interview-3429ac2454b/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值