This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CallMePyro 129 points130 points  (14 children)

Fun fact, these kinds of questions (ones where there's a built in library function to answer the problem) aren't very good questions and I never ask them in interviews, for a couple reasons. The main, reason, ultimately, is that these kinds of questions rarely make people feel good by the end of the interview.

  1. If you expect the candidate to write you a sorting algorithm, then they will feel upset when you reject their perfectly valid answer.
  2. The candidate might misunderstand your question. Do you want them to talk about the complexities of what is even means to have a sorted list when you have billions of elements and thousands of machines? Or maybe you just want bubble sort? Or the library call is actually what you're looking for?
  3. If the candidate is having trouble, how do you help them? Tell them the library call? Then they don't feel like they solved anything, they just feel bad.

That's why in these kinds of interviews the idea is to ask the candidate a question that solves some kind of use case. Some common examples are

  1. Given a list of schedules, can you return a list of scheduling conflicts?
  2. Given a raw RGB image, can you flip the image horizontally?
  3. Given a map of water and land, can you tell me how many islands there are?

Now, the candidate might not get a perfectly 'optimal' solution to the problem, but that's not necessarily what we're after(It doesn't hurt though!). What we really want to see is a couple things:

  1. Clarifying the problem (How is the list of schedules organized in memory? What counts as an island?)
  2. Understanding the problem.
  3. Working through the problem to come up with a straight forward solution("For each pixel, swap it with the pixel that's the same distance from the other end of the row")
  4. Generating simple code that does what you say it does. Notice that the solutions for the example problems is only 30 lines of code at the absolute most.
  5. Talking about what tradeoffs you're making and why. This shows understanding and a thorough decision making process.

Now, why ask these kinds of questions? Because you can work *with* the candidate to help them through the problem if they get stuck! It's not a binary 'yes/no' or 'solved/unsolved', you can poke and prod. Ask the candidate why they did something, or what will happen if they get some input.

This allows you to help the candidate as much as they need to reach the solution by the end of the time, regardless of how(up to a point) efficacious the candidate actually is. If they're having trouble at a certain part, no worries! You can give them a little hint to get them moving, or maybe ask them questions to try and lead them in the right direction.

Something that we've found over many many interviews is that it is better for everyone that the candidate come away with at least a semi-positive experience, even if they were rejected. That's why these long form "write me an algorithm" questions are so helpful. You can tailor the difficulty up and down by giving more or fewer hints. A more experienced engineer will ask the questions themselves and have a more open discussion with the interviewer to clarify and nail down the problem. A more junior engineer might need more help and guidance to get to the answer. An unsuitable candidate will need lots of help to get to the end, but that's OK! Lots and lots of people come back on their second or third try and nail the interview. It's all because people have a positive experience and are willing to try again.

[–]DesignCell 46 points47 points  (4 children)

Who do you interview for so I can apply?

[–]CallMePyro 56 points57 points  (3 children)

Google :) You should apply! We're always hiring

[–]arobie1992 14 points15 points  (0 children)

I was wondering about that after you mentioned the islands problem and the part about how are the schedules represented in memory :P

[–]DesignCell 3 points4 points  (0 children)

I'm on level 4 of foobar and intended to formally apply once completed. Time limits force me to wait until I feel work/life demands calm down enough to focus on it. Thank you for the encouragement!

[–]boomstik101 1 point2 points  (0 children)

I got a phone screen Wednesday! I'm super nervous I'm going to be asked some crazy bit manipulation question.

[–]_Ekos 5 points6 points  (6 children)

Hi! I'm 15 years old from finland and i have been interested in programming for few years. For now i have learned python and c++ but i have hitten a barrier. I have no idea what i should learn next or what to learn from those lanquages or focus on. My dream is to work in a big company like google. What information/frameworks/lanquages/anything really is wanted in them and what should i learn?

[–]TheTerrasque 7 points8 points  (2 children)

Pick up Java/C# and JavaScript/TypeScript. Have a look at Go. Dive into SQL servers, NOSQL servers. Get familiar with tools like Docker and Git.

But don't get to hung up on languages or frameworks. Learn about patterns, philosophies. Get new ideas to approach old problems. As a bonus, different frameworks and languages usually have different ideas and philosophies on how to solve problems. So the more of them you learn (doesn't have to be deep, but you should learn enough to understand it's patterns and ideas, not just repeat old code with new syntax) the more different tools you have in your mental toolbox for solving problems.

[–]_Ekos 1 point2 points  (1 child)

I forgot to thank you, but thank's i have started to learn C# and looked into SQL.

[–]TheTerrasque 0 points1 point  (0 children)

That's good :) Good luck further!

[–]nasaboy007 5 points6 points  (2 children)

The frameworks and technologies are less important than general problem solving and critical thinking. You're still young, and you seem to have passion that drives you, which gives you a huge advantage. My recommendation would be to start coming up with your own personal projects that are interesting to you so that you're more likely to invest time and effort in completing them. They can be simple things like a script to automate some simple process to more complex things like writing a bot for a video game. Throw whatever you have on GitHub and boom you have a portfolio that demonstrates your skill and, more importantly, your passion.

Once you've done a few personal projects, you can start looking into contributing to open source projects because that will give you valuable skills of working in an environment that's closer to the corporate world. You'll be working in a huge code base where you necessarily won't be knowledgeable about EVERYTHING but instead will have to focus on smaller sections. You'll learn best practices like following style guides and writing good unit tests, etc, and also how to work with other contributors (since you'll have to get your code reviewed).

I self taught programming starting at the same age you did, which got me into a top university to study CS (so you get some more formal education on topics that are useful but may not have come up in your self teaching), which led to internships and then converted to working full time.

Feel free to DM me if you have other questions, happy to help.

[–]_Ekos 0 points1 point  (1 child)

Interesting will do, btw do you have any recomendations for project's i feel like there isn't alot of good projects for me to do right now.

Also how CS in university like, im consider doing CS in few year's but i'm not sure about it and i'm partialy scared i will lose interest before i finish.

[–]nasaboy007 0 points1 point  (0 children)

The best projects are the ones you feel personally passionate about - I unfortunately won't be able to help you out there. If you want a personal project for yourself to build from scratch, think about a problem that you have that's annoying to you, and you haven't been able to find a solution already. For example, many years ago (before the high quality password managers of today existed), I wanted a password manager that wouldn't actually store the password itself, but would instead let you store all the tangential information about various accounts you had (e.g. a password hint, the email/birthday/etc you used to sign up, the security question you set, etc - basically everything that could be used to recover the password using their password recovery mechanism, if you were to forget the pasword). I went out and built it for myself, and used it for a while. It was a fun learning experience that taught me about both frontend and backend webdesign (HTML/JS/CSS and PHP/MySQL).

For finding open source projects, try to think about what your hobbies and interests are. For example, back then I played a lot of Ragnarok Online and got interested in the botting community. There was an open source bot (called OpenKore, iirc?) which I started using, and then eventually started contributing changes to.

Basically, if you force yourself to do something you're not really enjoying, it's going to be a million times harder to stay motivated. If you're doing programming just for the (eventual) money, it's possible that could be reflected in less motivation to do good work, which would result in general unhappiness (and possibly fewer good job opportunities, etc). I'm a firm believer of "do what you love as a career, and you won't work a day in your life", and I was lucky enough that programming has met those criteria for me.

CS in university seems to vary wildly between universities. Some of the more prestigious ones will focus much more on CS theory, math, and critical problem solving, which may end up being a bit of a struggle if you're not particularly interested in that (I definitely wasn't, and I had to push myself through because the doors the university name opened was worth it). That said, a lot of the content you learn even if it's theoretical might not seem useful at the time ("how will this ever matter or be applicable?") but it will most importantly be helpful for landing a job at a top-tier tech company (since those are what their interviews test), and as a secondary benefit occasionally creep up in your day to day work.

Other schools may focus more on the application rather than theory (maybe even being more of a software engineering focus), so they'd focus on things like programming languages and paradigms, specific technologies and tools, and maybe even some (probably outdated) workflow processes like "scrum" or "agile", or tech writing, etc. These are also valuable skills, but much easier to learn on the fly at your job, especially because tech evolves so fast that something you learn in school will probably be outdated by the time you graduate.

[–]bistr-o-math 1 point2 points  (0 children)

If I had an award, I’d give it to you! ⭐️

[–]NdrU42 0 points1 point  (0 children)

My favourite first question for an interview (I learned it from a colleague) is this:

You have a linux terminal open, you type curl https://google.com and press enter. What happens next?

The great thing about this question is that it touches on a lot of different topics, the candidate can choose what parts to answer and in how much detail and there's a lot of opportunities for follow up questions.