Ask HN: How can I prepare for a coding interview in a week?
I am from ECE background, been working in machine learning, and data analysis fields for couple of years, and have decent coding experience in Python and C/C++.
I am about to be interviewed by one of the big five (they reached out to me, I wasn't actively preparing for interviews).
Not being from a CS or software engineering background, I never took an algorithm and data structure course, and from what I know the coding test mainly involves those.
I know there are a ton of resources online for coding interview preparation, but I wanted to seek suggestions on an efficient/quick resource given that I have strong coding skills but not familiar with data structure/CS algorithm.
103 comments
[ 2.7 ms ] story [ 176 ms ] threadPerfect if you want to crack something in a week
- Only if they take a completely trivial amount of time
But look at it this way: if you want to hire a musician to a band, and you do large scale hiring, you probably want to put some minimum requirments like being able to play, and maybe handling rudimentary musical theory and being able to read sheet music. CS 101 stuff is exactly this - you understand the fundamental concepts and are capable of conversing in them.
Musicians who have formal degrees are understood to handle the basic theory and everything that matters is how well they can play.
There is no degree in CS that would guarantee you understand the fundamentals or you know how to combine the basic concepts into practice. I presume this is one of the rationales for whiteboarding.
Of course, there are all sorts of weird and wacky bands that have other hiring policies but the big five are not weird nor wacky.
Apparently how well the hiring went does not predict anything abouy on-job performance, but probably some whiteboarding will not let those people in who would be totally incapable of operating with basic CS theory. Sure, this leaves lot of potential talent out, but often hiring a bad apple is lot more expensive than discarding an ok candidate.
At some point I think it was intended to be like a 'coding-oriented IQ test', after you'd passed a set of HR checkboxes. Obviously an IQ test you study carefully for is not a broadly applicable measure of relative performance. As far as I understand, many of the top companies are shifting away from this interview paradigm, but it'll take the rest of the industry which adopted it a long time to catch up (I imagine).
* Minimize the time spent by their engineers interviewing candidates,
* Standardize the process as much as possible, so that anyone can run the interview.
I'm convinced there are many reasons for smaller shops not to blindly follow Google's practices. But as a candidate, what can you do... it's their loss, I guess.
Gold
Who's 'N'? If it were an 'M', I would imagine Microsoft, but nothing comes to mind except 'Netflix', which I don't consider to be on par with the rest of the group by any means.
https://www.investopedia.com/terms/f/faang-stocks.asp
You are competing against other people. If you are not particularly interested in winning then by all means don't do any training. Same deal for athletics.
[0]: https://en.wikipedia.org/wiki/NFL_Scouting_Combine#Bench_pre...
I think programmers are more reflective and analytical than people from other industries, so programming as an industry gets a lot of flak from the inside, but I really believe it's no better anywhere else.
"Half of programmers can't program! What's wrong with this industry?" Half of everyone is completely and utterly incompetent at whatever they're paid to do, why do you think we're special? Programmers just happen to notice these things.
"The interview process is broken!" Yeah, so it is everywhere else, programming is just the only industry where someone would possibly even care about whether something is insane or not.
'Tis my two cents.
Company knows how the interview prep is, and the candidate that understand more how to solve non-trivial problems can be the right service provider for that company.
I'm not talking by experience but what I was taught, I'm currently finishing my university but the Data Structure and Algorithm course is one of the most difficult to pass and that's only basic structure. A candidate able to think fastly about dynamic programming or structure a possible solution for a NP-complete problem can provide a service that others candidate can't.
Interviews are a sales process. The test can never really be an accurate assessment of how well you work - we don't even have that for full-time employees over a year, so how well it works over a couple of hours is never going to be that great.
Also, preparation is part of the test. Some interviewers like to ask questions about what you know about the company to see if you've prepared by reading their website etc. I've seen people be marked down with "obviously he didn't prepare for this interview, so he wasn't that motivated".
https://en.wikipedia.org/wiki/Signalling_theory
I'm excited to be interviewing programmers in the near future as our company grows. I have to think through a lot of things, but I'd like to focus on: Have you successfully deployed an application before? How have you overcome the technical challenges of programming on a team. How have you improved your abilities over time. Explain something you're proud of creating in the format you're most comfortable with. How do you power through losing passion about a project? How comfortable will you be learning new frameworks and paradigms? Prove to me that you're an able programmer in whatever format you'd prefer. Etc.
All questions available ahead of time. Try to keep things comfortable for the candidate. Enough depth and variance to figure out if they have the technical skills you need. You get to see how they like to work.
Owners started tech business using trust-fund money. They were extremely non-technical, scared of computers to be honest. They hired people that were like them (also non-technical), and didn't have the ability to properly vet candidates. Tech staff was hired basically off of Craig's List with very little interviewing. Tech was built and company got large enough to get a couple contracts (heavily influenced by owners' existing personal connections).
As you'd expect, tech stack started creaking under the load. At first tech staff thought they had everything under control (strong Dunning-Kruger effect, bolstered by early successes). Eventually tech staff realized how badly things were going and started lying to management to cover for their own incompetence.
Decent tech management was hired (I think by accident) and the tech staff saw the writing on the wall. The entire tech staff just didn't show up to work one day. Left without any notice or warning (the more intriguing stuff tangents off here). New, more capable tech staff was hired (including me). At this point the system was hemorrhaging data and users. We triaged, stemmed the bleeding, and built out a decent infrastructure with a decent tech stack.
Unfortunately for them that was too late. The contracts had fairly stiff penalties for non-compliance, and the company was in non-compliance for a looooooong time. The owners had made some false statements about the assets of the company, and settlements offered were based on those statement, far too high for the company to pay. Other companies were pissed about that and took it to court. Owners ended up getting taken to the cleaners and lost pretty much everything, including a bunch of assets that they had owned before but transferred to the company (including real estate) in some fairly shady tax dodge scheme.
Ultimately the world is a better place now that this company doesn't exist. It operated in an extremely sketchy manner, and I left when I found out the gist of what was going on. I learned the earlier and later parts of the story from personal connections.
Does that count? I mean, ultimately I think if you have poor engineering talent then it's management's fault. But you can make that argument for any corporate issue: it's management's fault for not recognizing the problem and addressing it soon enough.
Also, to be able to thoroughly study for and prepare for something on one's own, this on itself probably illustrates a lot about this person's qualities already. Of course it would be theoretically nice to spend all this time and energy on something that is unique to every person, but that is not totally realistic and would be hard to evaluate. One can still do that with their side projects though.
It's similar to what happened to higher education: 400 years ago higher-ed diplomas were extremely rare and it were mostly people who really held on to something to study, something to look into, that did those stuffs, and the institution could adapt to their needs individually. However, now that a huge percentage of the population get higher-ed diplomas, there has to be a standardized procedure to stuffs like university admission, issuance of doctoral degrees, etc.
What would you do if you were on the employer's side? Eventually people have to find a compromise and this is the solution that they came up with. Guess if I were on their side it would be hard for me to come up with something better and "safer". Also, it does suck to have to sit for exams which aren't necessarily directly related to the actual skills, but on the other hand I would say that that what I learned via SAT did indeed help my future studies, both in the university and by myself. I guess coding interviews can be perceived as something similar. There's no use complaining about the situation. One just has to face up to it and ace it, especially given how everybody else just has to go through the same. It's not something entirely ludicrous/Kafkasque after all.
Also, to be able to thoroughly study for and prepare for something on one's own, this on itself probably illustrates a lot about this person's qualities already. Of course it would be theoretically nice to spend all this time and energy on something that is unique to every person, but that is not totally realistic and would be hard to evaluate. One can still do that with their side projects though.
𝗗𝗮𝘆 01
* Backtracking - know how to solve 1 problem (Knight's tour)
* Tree - implement BST
* Tree traversal - implement DFS, BFS & DFS iterative
𝗗𝗮𝘆 02
* Quicksort - know how to implement
* Mergesort - know how to implement
* Binary search - know how to implement
* Min/Max Heap (priority queue) - know how to implement
𝗗𝗮𝘆 03
* Graph - implement adjacency list
* Graph traversal - implement DFS, BFS & DFS iterative
* Graph algo - implement "Prim Minimum Spanning Tree"
* Graph algo - Implement "Detect Cycles algo"
𝗗𝗮𝘆 04
* Graph algo - Implement "Detect Connected Components" algo
* Graph algo - Implement "Lowest Common Ancestor" algo
* Graph algo - Implement Djikstra single shortest path algo
𝗗𝗮𝘆 05
* Sets - Determine all subsets of a set
* Sets - Determine Maximum consecutive subarray sum
* Sets - Determine 2 sets intersection
𝗗𝗮𝘆 06
* String - Implement Levensthein Edit distance
* String - Implement Polynomial Hash
* String - Determine all substrings
* String - Find anagrams
𝗗𝗮𝘆 07
* String - Implement KNP algorithm for pattern matching
* Basic DS - Implement Queue, Stack, Dynamic array, Linked list absolutely cold
----
I chose javascript as the language for all this brushing up (no need to manage memory, and I can focus on the algo)
It's a big list, but it's a traversal of the CS engineering domain that makes sense to me, and it's only a fraction of the expected knowledge for that kind of interview.
----
Edit: I pushed some of the code of this list on GH here: https://github.com/netgusto/brushup
I struggle to implement each concept in the smallest, simplest way possible. I'll keep adding code as I write it.
Presumably because it is one of the big five (I didn't know there was such a thing). I suspect it looks good on your CV. You'll always be a big five alumni :-)
As an interviewee, you know that you're going to have a handful of different interviewers. What you don't know is how much of an effect each of those interviewers is going to have on the hire/no hire decision. Is one bad interviewer enough to torpedo you? Two? And you have no idea what kind of questions each interviewer will ask. So, let's say only 10% of interviewers ask these kinds of questions (I'm guessing that's low). That's a ~41% chance that you're going to have to answer this, and if one bad interviewer is all you need, then you'd be foolish not to prepare just in case.
As an interviewer, we're given surprisingly few guidelines on how to interview. You take a one day class, then shadow half a dozen interviews, and that's it. We aren't given specific questions to ask, and specific questions get banned all the time (any time they're "leaked" as a Google interview question).
Once someone is hired it's really hard to force them out, so approving someone who talks a smooth game but can't back it up is extremely costly. I've seen teams get stuck with multiple people for well over a year because it takes a long time to get them out, they won't leave willingly. Meanwhile they're taking up headcount and letting them actually touch code is dangerous. In fact, I've seen teams spend an additional engineer training them to the point where they are productive, just because that's cheaper.
So you want people to actually prove themselves with some kind of an algorithm question, but you get no real guidance on how to provide these and you constantly have to come up with new ones, but they have to be the kind of question that take less than 45 minutes to explain and solve. I have no doubt that some people fall back on these kinds of questions.
Yeah, I get that these questions suck, and I try not to be that interviewer. But as an interviewee I would consider it extremely foolish to not brush up on it, just in case.
To me, that's step zero. I still can't believe companies like Google, etc get stuck at step 0. They don't seem to care about step 1, 2, 3, 4. It doesn't matter if you have 1 year or 10 years of experience, we all go through step zero (again, even though we got an MS in CS a few years back).
So, if Google ends up in a situation where "teams get stuck with multiple people for well over a year because it takes a long time to get them out", it's because the hiring process at Google sucks. If it is that costly and painful to hire the wrong people, then why Google hasn't put more resources to actually innovate and think beyond college-like evaluations. It is OK for people with zero experience, it is not OK for people with at least one work experience (which I call step 1). Of course, if you have 10 years of experience they need to use a different language in order to interact with you. So, unless someone just graduated from college looking for a job, you can't hire someone exclusively based on step 0 because it simply doesn't tell you if a candidate knows how to write code, build features, work in a collaborative environment, deal with requirements from product team, reuse exiting code, handle code reviews and feedback from peers, create frameworks or adopt new frameworks. All it tells you is if your CS degree is fake or not...
This is not the only way to get into Google.
> Not once, not twice, we're talking about 7-8 times!
When I interviewed I had one 15 minute phone screen, and one round of in-person interviews. The in-person set was 5 people. Of those I think I cratered on one of them, did adequate on two, and stellar on the last two.
> Like they all say in Silicon Valley - the only way for us to know if you're a rockstar is if you manage to crack a few meaningless problems on a whiteboard.
Very few people get hired as a "rockstar", and the ones that do tend to be hired for non-coding roles.
> Oh... and make sure to pick your favorite language.
Yeah, the point is for you to answer the question and not get hung up on language semantics that you aren't comfortable with. I interviewed in C# despite ~0.1% of code at Google being C#. I had a very in depth conversation about contract differences between C# and Java that I think impressed the interviewer, despite me not knowing a single line of Java and him not knowing a single line of C#. If you pick the language and still struggle with the semantics of it, that's a huge red flag.
> Your Resume tells us you have a MS in CS but we don't believe it. So we're gonna put you back into a college-like exam to make sure your degree isn't fake.
An MS in CS doesn't, by itself, qualify you for a role at Google. I have plenty of friends who have the degree who I like very much, but I wouldn't want them on my team.
> I still can't believe companies like Google, etc get stuck at step 0. They don't seem to care about step 1, 2, 3, 4. It doesn't matter if you have 1 year or 10 years of experience
Yeah, I came in with 15 years of experience across 7 different firms. And I went through the same thing. I've also worked with people who have been in the industry for all kinds of timeframes, up to 35 years, and I've seen little to no correlation between "experience" and ability.
A higher-touch process with more "describe what you did at company X" would be nice. But it also feels easier to game. I read design docs for projects at all levels at prior roles, including rationale, alternatives, etc. If I wanted to pass one of those project off as my own through an interview I don't think it'd be very hard. I also don't see any other companies that hire at the rate that Google does (well over 100 software engineers per week) that manages to do that.
> So, if Google ends up in a situation where "teams get stuck with multiple people for well over a year because it takes a long time to get them out", it's because the hiring process at Google sucks.
So now you're arguing for a more stringent review process, but one that doesn't require actually demonstrating any abilities? Also, this is less of an issue with hiring, and more of an issue with staff management.
> you can't hire someone exclusively based on step 0
I'm not sure why you think that Google is "stuck" at step 0, or that we stop there. There is generally no feedback to a candidate about why an offer isn't extended. You're assuming that it's because of a whiteboard coding issue when it might be that your experience doesn't really mesh with what's needed.
There are a wide variety of factors that candidates are scored on, and there are plenty of them that have nothing to do with the code that's written on the board. I've had plenty of candidates that have gotten a "hire" recommendation despite not having an optimal, or even a correct answer on the board. I was confident in their abilities because they demonstrated that they recognized there was a problem, usually due to running through test cases, and that given enough time they would solve it. I've had candidates that have gotten a "no hire" be...
If JavaScript is your language then you are likely looking at front end development, in which case it will be much more useful to know about frameworks and testing strategies than CS theory.
Also, JS isn't just for front-end development. Aside from Node.js, which is increasingly a larger player server-side, it's also used in a bunch of desktop apps.
And yes, js is used in other contexts as well, but it is primarily used in front end developer. Which is why I used the word 'likely'.
An old, common, (banned) interview question goes something like this:
> Imagine you have a grid of squares, represented however you want, describing an ocean. I'm going to give you coordinates one by one that indicate land being created. You need to tell me in total how many islands exist after each coordinate, where an island is defined as a contiguous block of land connected horizontally or vertically, but not diagonally (or include diagonals if you want; it makes some parts of the answer messier).
The disjoint-set answer to this question is that you look at the coordinate's neighbors. If there are none, this is a new island. Create the node as part of a new set where the node is the "representative" of that set. If there is one neighbor, create node but make its representative the same as the neighbor's representative. If there are more than one neighbors then you have to do a union; create your node and make its representative one of the neighbors' representatives. Then go to all of the other neighbors and find their representatives (make take a couple hops). Then make their final representatives use the first neighbor as their representative.
At this point you have kind of a directed acyclic graph where each node has exactly one edge (maybe pointing to itself). The last improvement is to update each node's representative as you travel to be the final one. This amortizes out to a single hop for each node, after enough find or union operations.
Then you can start adding more data to the representative and dealing with merging that to solve some pretty complex problems in a shockingly low runtime.
Why not stick to data science, which is very hot right now?
https://leetcode.com/problemset/top-100-liked-questions/
If you've never took any algorithm course and have only a week for preparation, it would be very difficult to prepare for coding interview. But I think you can at least finish all easy problems from this list. In this case, you may at least pass screening coding interview.
Right now, I'm very actively interviewing with pretty selective high-frequency trading companies. I can say that LeetCode has pretty relevant set of interview problems.
One more thing. Even if you solved a problem, always look at description of solution, if there is no description of solution, you should look at discussion.
From there, you can find references to common algorithms/themes like binary search etc.
I turn up on the day, but then these interviews asking difficult algorithm question seem to be a rarity in the UK, thankfully.
Our interview process seems to be much more reasonable.
It's just a way to see who can learn those algorithms because the big five need to filter out most people somehow. This is their method of doing it.
Perhaps...I've seen a few share of those in interview situations or in pre-interview screening tests. I like the fact the fact that is a standard test that every candidate faces. I'm not sure that the nature of the tests has any relation to the type of work one will be required to in some of these places...
Also what I've noticed. Since the 90s, I've never been asked one of these algorithm question.
Most of it's just a chat about my CV and what they do. A good interviewer or developer would smell bullshit.
I sometimes get a few basic quizzes or fizzbuzz level exercises, which I don't have a problem with. Usually when I ask about it, it's just an extra filter due to someone in the past slipping through the cracks. Having worked with people who'd fail such tests, it's a good signal knowing my potential team members are at a reasonable standard.
https://app.codility.com/programmers/lessons/1-iterations/
and try to do at least two exercises from each lesson up to lesson 15 if you can. The open reading material at the top of each section is excellent and discusses all the CS theory you will need.
Good luck!
Ive had interviews that re use the exact same questions (fortune 100 companies)
The good news though is that unless you lied on your resume, they already know that and are still interested in you. So you likely have other characteristics they are interested in.
I would concentrate instead on learning about the company you are interested in. That's something you can do in the course of a week.
I know someone who was able to pull it off in 2 weeks, though they were unemployed at the time. They got into Google with 7 years of prior experience at the time. He admits a lot of it was luck. But it's possible.
Algorithms and data structures are 1-3 classes out of ~45.
https://www.educative.io/collection/5642554087309312/5679846...
Also (again personal opinion) - python is the most practical language for doing interview questions, because interviews are heavily time-constrained and python allows the developer to go from idea to implementation in the shortest amount of time. I'm not going to penalize anyone for their language choice, but somebody who completes the task in 5 minutes and then spends 25 minutes getting bonus points for things like "what if the input data is larger than RAM?" is going to come across stronger than someone who spends 30 minutes on parsing the input and runs out of time before they get to the algorithm.
i'm not sure if python is the best, but it's a very strong choice. python also has a lot of built in data structures that are relatively non-broken and highly useful for the archetypical algorithm-prototyping interview questions
e.g. if you are using a language that only lets you use strings or ints as keys for dicts/hashmaps - instead of say letting you use immutable compound values as keys, or a language that doesnt give you set data-structures which support basic set operations (contains, equal, subset, superset, intersect, union, etc), or a language that requires you to write a paragraph of OOP-boilerplate to encode e.g. a list of pairs of values, you're making life harder for yourself than necessary.
also, i claim without evidence that prolonged and continuous exposure to working with languages that dont offer sensible data structures, or only offer broken data structures, may over time hamper your ability to think and problem solve clearly.
https://shop.bigmachine.io/products/the-imposters-handbook
This will not guarantee you a pass — honestly, some people spend months preparing for the big 5 interviews — but it may give you a fighting chance, and either way it will give you a good foundation for future interviews.
https://leetcode.com/problemset/all/
And frankly, given your lack of background in this area, it would do you a world of good to get more time to prepare. Try to push the interview back a bit. Even one extra week would be an improvement.
Tell the recruiter you need a month to prepare or they will have to skip the CS basic screen for you in order to fast forward the process. If you're one of these niche developers (python/C++), you might have a little power when it comes to asking you the right questions. Same goes when a company originally contacted you, you're in a position of power.
Not trying to correct you, I'm really just curious since I have a similar background and an in a similar situation to the OP.
As someone who is coming from another web dev job, not coming right out of college.
Will I still be quizzed on data structures and algorithms? Or will it be more on-topic subjects like frameworks, patterns, architectures, etc?