893 points · by db48x · 4y ago · 448 comments
Over the years of evaluating with it, we learned a lot about its quirks (both false positives and false negatives). At one point, someone got so frustrated that they threw their laptop on the floor. Happy to answer any questions about it!
But the OP says this:
> When you’re maintaining a large codebase, there are always going to be codepaths you don’t fully understand
Ugh... I hate modifying code I don't understand. That doesn't mean I need to understand the entire code base, but if I'm modifying a portion of the code base, I'm loath to touch it till I understand what it's doing.
Also, of all the work I do, I consider this the least expressive of my ability. It's such a mechanical thing to do and doesn't require a whole lot of thinking?
So I guess I can see how this skill—for a job at your company—is necessary but in no way sufficient.
[1] e.g. https://github.com/git/git/search?q=jaysoffian&type=commits, https://github.com/google/breakpad/commit/6446cfcff088b8682b...
I work for a FAANG company in a senior position and I know I will fail FAANG interviews w/o advanced prep.
The second try I practiced.
This is also me. I get flack for spending too long on what seem like "small" fixes but I can't be sure (especially in spaghetti code) until I've dug through it. On a couple occasions, different companies unfortunately, I caught flack for spending too long trying to understand critical finance code. As in, how we were billing every single customer. But it always yielded results, and a week later I'm in a meeting explaining how abc original implementation would have broken xyz, but the scowls never really go away. It's frustrating.
These are generalisations. There are likely far more “types” and different people will act as different types in different situations.
Having a mix isn’t sufficient though. The team also needs to find ways to prioritise and manage conflict to get the best approach in place for any given situation.
Edit: same thing in this interview question, the whole point is super quick performance and working under time pressure, and making changes to code bases that you don't have time to understand, why?
This is okay and to be frustrated at it, but it's important to recognize why it's happening.
FAANGs go through an incredible number of candidates with only a few slots (comparatively) and the point is to simply make the bar higher and higher. Just like a pragmatic engineering - you have a 'good enough' candidate set.
For me, the problem is when smaller startups copy the format - expecting candidates to jump through all the same hoops. If a FAANG has 1:100 position to interview candidates ratio, a startup will be lucky to have 1:5 (it's incredibly expensive/time-consuming for a startup to interview).
Running the same test likely means you're rejecting a lot of potentially good candidates who didn't want to go through a 'FAANG' interview.
If any of the candidates they are refusing are capable of doing the daily work at a FANG but can't pass the interview, they're artificially constraining their supply of candidates and increasing the cost they need to pay for developers for absolutely no reasons.
The type of work in a FANG is mostly not that dissimilar to other companies (the exception being teams working with machine learning, performance optimization, dealing with tricky scale). I understand hiring specialists for specialist jobs (and I still wouldn't test them on leetcode; ask domain specific questions).
It's just ego driven over spending on developers.
This doesn't fit the "we can't find candidates, so we need more H1B's" narrative.
Supposedly, there are many open slots, unfilled, so purposefully failing people which can do the job, which meet the minimum requirements, should not be the outcome.
Instead of raising te bar, as you say, due to candidates o'plenty.
That said, there were also plenty of candidates who came to the question guns ablazing with the same attitude, and then failed miserably. I'm not saying that's you -- but rather that it worked out in practice to be a fairly good filter for whether people actually had (enough of) that skillset.
How did you rate your negatives to judge the filter was correct? You know the "Positive" status, you know your true and false positives from the interview question (People you hired that performed well or didn't. Or said another way, the predicted value was positive while true value was positive or negative).
But did you know your true and false negatives (the people you didn't hire that would have been good or bad. Or said another way, the predicted value was negative but true value was positive or negative)? Did you know the candidates you rejected who would have been good at fulfilling the roll at your company (False Negatives)?
To be clear, I don't know the false negatives either and the interview question may be the best litmus test for the behavior desired, minimizing false negatives and maximizing true positives. But I just don't know for sure if the question did work out in practice to be a good filter of people with that skillset without a true negative dataset. The Precision is good, but the recall/sensitivity may not be. Then again, you probably know how the candidates you hired performed before you used the new question and after - which may be an indicator on false negatives.
Also, that does seem like a really fun interview question to answer for me. Kudos.
EDITED: Changed the question at the same time the response came from OP. Original post asked if they hired those who failed the test to know more about the negatives. They did.
Most of the time it will be debugging some arcane crap or adding to an existing codebase, anyway.
Still, just knowing they exist and how to formulate the search is usually enough.
I am sure one was a reference in the golang source code. And I once wanted to check multi-way merge sorts (tournament sort).
> This challenge is particularly well calibrated for an interview because there is only one correct answer: “change bool incr to int opcode” (or anything isomorphic to that). The codebase and problem statement together very clearly imply that there are currently two arithmetic opcodes, and your job is to extend that to three arithmetic opcodes. [...] Cloning even one of these functions is probably suboptimal, but I might spend twenty minutes before realizing that.
I just completed it sans writing tests (took ~30min), considered and discarded that approach, instead duplicating the code-paths (leaving incr/decr untouched and instead making mult_ versions of everything). I did reuse the delta_result_type, though.
Briefly my reasoning was that this would make the fork easier to maintain against hypothetical future upstream changes and keep the logic simpler, while guaranteeing that I didn't miss to implement any particularity - compiler would complain about missing constants or functions as long as I covered entrypoints.
A bit of rule-of-three thinking: If in the future there would be even more arithmetic functions added, maybe it would be prudent to refactor and generalize parts of it? But not at this point.
Curious to hear if you agree with OP that my approach was incorrect or with me that it's equally valid (:
Whether or not your approach is "better" depends on factors that aren't part of the problem statement, so it would be a mistake to assess it as incorrect.
If there already are two arithmetic opcodes, shouldn't both of them already be handled by the same code, only with an operation parameter? In that case all that should be necessary is the handling of that parameter in the place where the operation is actually performed, and you only add one more value of that parameter.
Having said that, I haven't looked and memcached yet how it actually implements these operations. I'll have to do that.
Changing a bool to an int is the kind of thing that I would worry would have unknown side-effects somewhere, whereas adding new code paths is unlikely to explode the existing.
Upstream would be a consideration, and potentially seeing what kind of a patch they'd accept.
> "diving into an unfamiliar area of the code and quickly figuring it out" was very important for us.
Universally applies to all software jobs.
What's I find interesting (based on my own personal history) is not only the ability to solve a task in an unfamiliar code base, but also do so without creating side effects (like say quadrupling the size of a binary since you incremented a poorly named constant that is reused as a size of a memory allocation by multiplying itself with itself).
I dunno, I've worked at a bunch of places where it seems people have gone "I'm not bothering to understand the old code, I'll just replace it with <framework/technology du jour>[1] and GOOD LUCK MAINTAINERS."
[1] Sometimes they write their own frameworks. These are almost always the worst.
I'm amused at the comments suggesting this is too easy (or your own suggesting the same for redis), I think if I tried this I would have filtered almost everyone, at least if they only had an hour (minus time for soft resume questions to ease them into it, and questions they have at the end). So many programmers have never even used grep (and that's not necessarily something to hold against them at least at my last job where the "As hire Bs and Bs hire Cs and Cs hire Ds" transition had already long since occurred). I've made two attempts at the idea though by crafting my own problem in its little framework, the latter attempt I used most involves writing several lines of code (not even involving a loop) into an "INSERT CODE HERE" method body, either in Java or JavaScript, and even that was hard enough to filter some people and still provide a bit of score distribution among those who passed. Still, I think it's the right approach if you have a large or complicated existing codebase, and even in the confines of an hour seems like a better use of time approximating the gold standard "work sample test" than asking a classic algorithm question.
I wouldn't necessarily consider these questions a substitute to an algorithms question, but rather a way of obtaining a different and important signal. An algorithms question may be a valuable signal too, depending on the nature of the role.
That said, I don't think this is a VERY easy task, per se. And even if it were, there's achieving the stated objective, and then there's you taking the ability to demonstrate some additional skills. I'm in the Java world, and whenever I requested candidates doing exercises, them building a solution with no unit tests, or at least not voluntarily acknowledging that omission, would be a red flag.
And then I'd ask: let's say this wasn't an exercise, what things would you add before shipping this to production, which would be a great conversation starter around (again) testing (second chance), observability, logging, and so on.
We had other questions (which I won't spoil) that tested more complex system-design skills, without having to implement them within an existing codebase. We felt this provided clear independent signals (ability to "hack" within a codebase and ability to reason through complex system design) vs. conflating the two.
As the team grew, and we needed folks who were much better at one or the other, this helped us round out the team with folks who excelled at either skill.
It can start with getting it to compile in the first place. I've spent days on building C code bases, getting the dependencies there, everything in place, then you wait, then there is some error, then you google, then you don't find anything, then you debug a makefile of one of the dependencies, etc etc. Some projects don't compile with packages from apt-get at all. Take most Rust projects for example, unless you are using a rolling release distro, your rustc version is too old.
Then you need to look at the quality of the code base. Sure maybe it's just a simple else if chain and one of them has an add and sets result = a + b; inside. Then you can copy it, modify it for multiplication, done. Trivial!
But maybe it's done via a plugin system and spread over 5 different components, and there's actually two plugins you have to add, one for the repl, one for the internal handling, and there is non trivial communication between them. So you copy the 2 thousand lines of plugin code spread over 8 files and there's a bug. How do you debug it?
You also need to be able to start the thing. Maybe it's not meant to run on developer's laptops but instead is deployed in the cloud and you have to use some unfamiliar tooling to access it?
Now, apparently in this instance the project was easy to compile, modular enough (and also not too modular) for the position needing the change to be identified in quick time, and easy enough to run and test that you could also explain your solution in one hour. But this is not guaranteed.
In enterprise Java, there is almost certainly a crazy amount of indirection, both static and compile-time.
A trivial task like "Write an API to retrieve a certain set of records from the database, and return them to the client caller" can involve:
1. Figuring out how the framework calls your API, and where the parameters are in the call. This is specified in some config (yaml/xml/whatever) file somewhere that the framework reads so that it can validate the parameters before it passes them to your code.
2. Figuring out the config-file syntax for specifying the validation criteria for each parameter and for the return value.
3. Determining if the specified list of columns is already encapsulated in an existing class. If it is, you're luck, just instantiate that class with the correct criteria and read the fields into the instance you will return to the framework.
4. If no existing class satisfies your needs (99 times out of a 100, there won't be), you realise by looking at similar existing API code that you need to create a application-logic level class that contains fields with all the values you require.
5. You do #5 above; then you read the existing API callchain again, and see that all other application-logic level classes don't talk to the DB directly anyway. They go through a DB-level class. This is because at some point in the future someone may want to swap out the underlying DB with another DB.
6. The DB-level class is tied to a specific ORM (say, MyBatis). It uses classes generated by MyBatis. You write your DB-level class to use a MyBatis-generated DAOClass.
7. You then dig into the details of the ORM, figure out which config-file (xml/yaml/whatever) to modify, how to write the template that contains the specific parameterised SQL statement (if using SQL), how to specify to the ORM that each column be matched to a specific Java type, and how to convert it if it is some other type.
8. You Aren't Done Yet! For each of those classes you created (the API handler, the Application-level class, the Dao class and maybe the generated classes from the ORM, you need to write unit-tests! The unit tests, in this simple example, will easily be twice as large as the actual new code written/generated.
9. You're done, for now, until integration testing in a pipeline fails. But that's a different issue that will always exist regardless of language or development methodology, so that one gets a pass.
And, believe it or not, the above is actually a simplified version of how it actually gets done. For example, there's going to be more lines of code mocking an instance in the tests than there are lines of code implementing the class itself.
Also, the framework calls your API, but your API probably doesn't directly instantiate the Application-level class - it hands it off to a 'call_handler' type of class that performs a threaded/sleep invocation[1] of an actual 'call' method in your API class.
Also, anything your class may need (instances of other classes that perform non-local stuff, like recording metrics, logging, lookups, etc) will be injected at runtime, and so you cannot simply declare an instance of the (for example) LookUpAddress class - you have to request an instance of that class from some sort of dependency mapper or injector, which will be provided to you when the framework calls into you.
This is normal. There are various reason for every single step above, and large companies (FAANGs, for example) will adhere to every single step (and more, like using classBuilders) because it checks all the boxes except velocity.
A startup, OTOH, had better forgo all of the above; create a monolith with no runtime injection or modification and skip all the unit tests (use more beefed up integration tests, for example). A startup can't afford to spend a day adding a single simple API, when, in the same time, they might be adding 25 new simple APIs.
There's no point in all of the rituals if the startup finds out 5 months in that the product doesn't have market-fit. It's better to determine market-fit in the first month or two.
Having paying customers is more important than having dependency injection, or the ability to switch databases.
[1] When not using Java, the 'call_handler' will use some sort of async/await call to do a proper async request.
There’s a million different reasons for why they could bomb it and a million different ways they could succeed at it and none of those reasons might be evident to the reviewer.
(I’m planning to give the interview question a shot before returning to read any more of your replies.)
False positives: we hired a few folks who could prototype changes but struggled to ship them. This question wasn't solely to blame for it, but it wasn't enough of a signal on someone's ability to _thoroughly_ work within a large codebase.
False negatives: senior candidates who were very used to a particular programming environment (e.g. at Microsoft) and didn't have side projects that kept them up-to-speed with the basics of editing code on the command line over SSH. We did a lot of work over time to setup alternative environments for these candidates.
A couple years ago I was asked to interview via CoderPad and while I appreciate their attempt at having emacs and vim bindings, the fact that they're not actually accurate was worse than using Google Docs.
That is, it's actively worse to be almost your editor of choice than I think it would be to obviously be a "clumsy editor". In the former case, the interviewer perceives you as poor at writing code when you're fighting with a slightly drunk editor, while in the latter (like at a whiteboard) the interviewer adjusts for the environment.
Edit: the interviewers let me retry via projecting my screen while using emacs locally in a terminal. I hope CoderPad has improved it's key bindings since then, but I hope interviewers test out these editing environments before assuming people would be 100% proficient.
After I had two more technical interviews where I got asked more traditional leetcody questions.
I can't remember exactly, but I probably administered the question for Arthur when he interviewed (he may remember). I do (fondly) remember working with him.
Did the laptop throwing make you think you'd gone too far?
During the interview, the interviewee worked on the problem live, and the interviewer stayed silent, except for questions. If they didn't come up for air after 30 minutes or so, I'd check in and see if they were stuck, offer help, etc.
I recently contributed to letting in a false positive into my org. Properly interviewing people is a skill I need to develop!
Worst part of programmer interviews are coding as performance art.
I don't code "out loud". I kind of get lost inside my own head. I can explain myself after I figure something out, not during. If I'm supposed to talk, then I'm thinking about talking, not programming.
Obviously: I've never liked pair programming. Rubber ducking has never worked for me.
Also — we gave candidates one hour (the author of the blog post does not seem to remember that detail).
Rubbing ducking works, but only has a debugging measure. Explaining what your code is actually doing on a line-by-line basis can sus out the root cause of a bug.
I suppose that's the only time pair programming could work for me; by explaining what each line of code does, another programmer could stop me and tell me "No, that's not right".
assuming signed int16 (for simplicity of discussion), 32767 + 1 is far easier to error handle (a simple check of the max_int value) than 10000 * 4, unless you are just blindly allowing the range of values and don't care about overflow/underflow.
Looks pretty fun too actually! Nice work and I hope you got some good engineers out of it. Any other retired interview questions you're particularly fond of?
Later on, we tried to diversify the question to other codebases (because it leaked, although less publicly). I remember trying it out on Redis, which was too easy because the codebase is so nice. We never found a great alternative while I was there (through 2016). Although, the team may have found something since.
At my current company, Impira, we have a similar question on a different codebase :)
Did you have to do much searching at Impira?
You problem setup seems to assume that your interviewee is compeltely unfamiliar with memcached. So how do you expect someone to be able to answer this question if you haven't told them how to add commands to memcached?
[UPDATE] Ah, I see you actually want them to go hack on the memcached code base. That is not at all clear from the problem description. The language of the problem setup is pretty elementary. I think anyone who is actually capable of doing this task would find the description pretty condescending.
Seems like everyone else here thinks it’s perfectly clear.
Our programming challenge: Add a mult command to memcached.
Maybe "adding a command" involves "hacking the codebase"; maybe it doesn't.From the problem statement as such, you can't tell.
Interesting approach, I bet your codebase is a thing of beauty...
I saved up enough that I paid off my house and I opened a bar. I just don't have the heart for the /r/iamverysmart crowd, that always paints themselves into the same corners because "neat and new", or dealing with more political crap where the customer is never a thought in their equation
Yes, it would be great to avoid hiring people who have a bad temper and tend to throw tantrums when nervous, but, then again, it's beyond me why anyone would need to prove they can cope with such pressure without breaking down. We're talking about a desk job here, which requires writing good quality code according to some requirements during normal working hours, not disarming a bomb with a timer attached to it.
Where's the pressure? You have a piece of code, all you need to do is read it, understand it, make a (possibly) trivial modification. That's exactly what you would be doing (or have been doing) every day. You don't have to explain complex algorithms on a whiteboard. There are no high stakes. You can leave whenever you want.
Last time I had to do something like this I was allowed privacy, internet, headphones.
the pressure comes from the context - you're in an interview situation, faced with a previously unknown task (presumably you haven't done something similar before). The result of this "test" determines your candidacy in the job (presumably you want or need this job).
It's like asking why a bomb defuser feels pressured.
The stakes and environment aren't even close for this to be a meaningful comparison. A job interview will always carry some degree of pressure, no matter the circumstances. What I fail to understand is why would someone feel more threatened by this scenario as opposed to, say, answering a barrage of technical question or solving algorithmic problems.
For example, I have broken the build in the past - and this prevents everyone else on your team from merging PRs. In this case the expectation was that I fix it "soon" - once I finish my current meeting/lunch/conversation.
If someone is prone to breaking down from pressure given 3 hour deadline, they would have a breakdown right there.
Even if you have the best QA process in the world, and people can't break the build because you can't merge code that doesn't pass the test suite, at some point you are still going to ship a bug to customers, and even if your manager is the nicest person in the world it will be a very uncomfortable situation once you realise that your bug is losing customer data.
If you can't deal with an occasional stressful situation, life is going to suck for you, because there are always going to be stressful situations.
Being given 3 hours to add a minor feature to a pretty run-of-the-mill C program really shouldn't be an issue to anyone who is familiar with C, assuming the job asked for experience with C.
Sure job interviews are stressful, but if you can't calm yourself down in 3 hours and do something that would take an average C programmer maybe 30 minutes of time, you probably aren't a good fit for a job where people are going to rely on you.
You look at the issue and say it's a personal issue. I look at it and see a dysfunctional development environment issue. Now this doesn't always hold true and sometimes devs have to be held to higher pressure environments (such as having on-call duties): but those kind of things are usually better compensated for and called out as part of the job duties.
That said, I wouldn’t necessarily give this question to the most junior candidates. Coping with a large existing sourcebase rapidly is a set of learned skills even if it’s just cargo-cutting a solution like this.
Either you have been lucky with the places you've worked at, have sifted through tens of shops to find a good one, or have very little experience in the industry. I really do hope that none of my assumptions are true and that one day I can find a functional, low-pressure team to work with.
Having said that, for this specific case, 3 hours seems like a lot of time. All you have to do is find a similar command (probably the increment), trace it in the code (possibly with a debugger and some breakpoints), and copy/paste to add the funcionality for the multiply. Then, see if it compiles, it won't, and keep repeating until it compiles. Then, see if it works, it won't, and keep iterating until it does.
To be fair, in my first job 20 years ago I did this exact sort of thing for 3 years on a very large C/C++ codebase. Also, later when I was at Facebook I did this a lot in that humungous codebase (searching the codebase, finding the right place to make a change, looking for something in the neighbourhood that looks similar and can be copy/pasted).
So this interview question would be right up my alley.
Stories about someone so frustrated they threw their laptop on the floor are genuinely sad. Like, what are people trying to achieve with a test like this if that is a possible outcome? No one would expect a solution to this in 3 hours under normal conditions, regardless of whether someone can push one out - I got something going in an hour, and I have no idea what the hell to make of the code base now except that a) it builds and b) it works according to the fairly vague parameters of the task, i.e. input `mult age 10` to your telnet session and get 380. Regression testing be damned, especially considering there are no parameters for testing (does that 3 hours involve rewriting a bunch of Perl to support the interviewee's hacky changes? It takes a while to run `make test` ...)
Other commenters are saying that it is outrageous to expect someone to put in 3 hours work, without pay, to produce a meaningful result. I agree, as this is notionally their profession, and people are not generally in the business of handing out their work for free. That being said, I haven't had to deal with Leetcode in my career (yet) but from what I've heard it sure beats that.
Lucky you... I'm at my 8th job now and Leetcode-style interviews pushed me to the point where I ask up front if this is part of the interview process, because, as stated on my LinkedIn, "I have a personal policy against any type of live coding or online coding tests during interviews and I don't enjoy or engage in any form of competitive programming". If that's a showstopper for them, then they need to find someone else.
I didn't comment here to propose an alternative, just to point out that the proposed approach isn't so good for some people, including myself.
Since you asked, maybe people should stop looking for the one true way of interviewing and realise that they're hiring actual humans, not robots. The hiring process in this industry has become this lazy meat grinder which most people with actual decision making power swear by while bemoaning the lack of diversity (and I don't mean just gender). Some day, perhaps the industry will move towards more inclusive approaches.
We should think very carefully about adding a multiplication command because it introduces a failure mode that may be unanticipated by the client. Code that previously worked could begin to fail after this command goes into use.
Specifically, if the client needs to revert a series of operations on integers, and if the operations are transitive, there is no need for a mechanism to ensure they occur in any particular order (the usual caveat about working within the limits of precision applies.) This holds true for addition and for multiplication, in isolation, but is not true if they are combined. Change the order and the end result will change. Adding multiplication puts a burden on the client to understand this risk and be explicit in the ordering.
Some people may argue that the client should already understand it and they have a point. We can't defend against every possible misunderstanding. I think there is a good discussion to be had on this question and if the candidate were to go there, it would be a favorable sign of experience on their part.
But, to be fair, there's already technically this issue in the memcached API as described in the post, in that it supports both append and add, and "append 0" (on a value that add could also act upon) is effectively the same thing as "mult 10". If a field contains "1" and successive "add 1" and "append 0" commands come in, depending on what order they arrive in the result could be 20 or 11.
So I think the interviewer would be justified in saying 'yeah, let's assume we've evaluated that risk and we plan on adding some really thorough documentation warning people about that risk, so can you just go ahead and try and implement it?'
But absolutely, this was the thought that came into my mind when reading the spec too. Not enough developers think about APIs in terms of compositional, algebraic terms, and being able to see that adding 'multiply' and 'add' together at the same precedence in an API might cause trouble is a really valuable skill.
I agree -- but unfortunately the interview question doesn't filter for this level of thinking.
If anything, it filters for the exact opposite: your ability and willingness to shove a random new feature into the codebase in 3 hours (or GTFO) -- stability and other consequences be damned.
But they would certainly be disappointed in candidates who don’t take the opportunity to show off the programming skills that they have put on their resume.
if(delta > value) {
value = 0;
} else {
value -= delta;
}
A caller reverting operations by sending the same values with the operations flipped around must already keep track that they didn't ask to drop below 0, or they may not get back to the original value.Plus, the atomic update happens with a lock/release between each operation, so while you might get the same result at the end of your rearranged ordering, clients may see intermediate results and changing the order would change which values they see, which may or may not matter.
But I like to talk about programming, and this question just creates so many different kinds of ideas in my head too. I like how you immediately think about ordering of events and the implications of that. Maybe memcached needs a division operator too. I think that's fun to talk about. Maybe overflows are important; Maybe the task is to add some new types to memcached to protect against that. Maybe we should add some stats to track the number of overflows (or otherwise give some estimate of the accuracy).
Now I am looking at the slide-rule on my desk and wondering what the required precision for the use-case is; That is, is it possible that instead of modifying memcached and having to support your freaky-version forever that you can simply instruct the application to increment by log multiplied out by the desired precision, then reverse with division+exp on output?
And now I am thinking about supportability: Once we've decided what we want out of memcached, is it worth trying to get those changes into the upstream memcached so we don't have to worry so much about that feature disappearing (or becoming difficult in the future)? Talking to people about the social aspects of programming with open-source can be important too.
So yeah, lots of reasons to like this question. I'm probably going to use some variant of it myself, because wherever the candidate goes with it is going to be informative, but I'm extremely disappointed by the rest of the process (and all of part 2); it's definitely not for me.
Why did you add the word "many" where?
I didn't use it. I can count on one hand the number of people who flat-out lied to me about being able to program and I needed to fire them for it, and I've been managing and developing software for around thirty years or so.
Do you think that's a lot? Or do you think people lying about what they do is common?
You can maybe get away with this practice with a small enough company, but even then, I'd advise extreme caution. If you can filter people out before offering them a job, you're in a much safer position legally.
Edit: I think you're in the UK. I don't know much about employment law over there, but I gather the situation is actually better.
I'm in Portugal actually, but I've lived in the UK and the US (I've actually worked there for almost 20 years). In a past life I was hired as the country manager for a British company working out of New York, and I had to receive training on employment law in both the UK and US because they actually take it very seriously in the UK, much more so than in the US; An employee (or former employee) can ask tribunal to decide if their termination was fair, and they absolutely do look for race and gender selection. I can appreciate Americans might not get a very good education on workers rights, so it is perhaps worth mentioning to an American when I fire someone, I'm doing it after I've had that decision reviewed by council, and with that training.
Now when I said they lie to me, perhaps you got some idea that was just my opinion or something. I didn't mean to imply any amount of whimsy and tried to avoid any words that might suggest it; I admitted elsewhere I've fired less than 5 people for lying to me, and that's paper evidence of a lie. I've probably hired hundreds of people at this point in my life, so we're talking about a 1-2% problem where even if we have to pay a six month settlement, that's peanuts compared to what we save:
See, if I had to spend 3 hours for each candidate, and maybe out of hundreds of people I've interviewed thousands, we're talking literal years of my life. I can't realistically do anything else with that time. And not just my life- I have a fiduciary duty to the company I work for, I can't in good-conscience spend the money in the budget for my salary to avoid a much smaller potential penalty that probably won't even happen.
But I think it's important to think about some of the things you're saying: If someone thinks they're doing what I'm doing, and find themselves firing so many people that there is any racial or gender bias in the pool they're firing then I don't think they're doing what I'm doing. I might even wonder if they're racist or sexist myself, because my point is this shouldn't happen often enough to worry about.
And finally this problem looks a lot like can you see a pattern!! I mean sure but a lot of people who might go to interview with standards of competitive programming might take the whole 3 hours because there's a lot to rule out.
I guess this is a fair question with a proper IDE and grep tools. The timing does look outrageous but if you are interviewing at a company which builds databases as a product, you better know how basic operations are provided.
Redis source code is fun to read as well.
Type 1 will definitely take longer at first, but given a few months in your codebase, they’ll be able to make more effective trade-offs and understand the system better as a whole.
Talking generally of course, there are probably some type-2’s that will still find time to prod around, and some type-1’s that will never get faster… but I think someone who doesn’t just assume that their guess about how a system works is correct, will be more likely to produce quality code in the long term.
It could be that in database circles, nobody ever uses any magic and only very strong locks are employed, and perhaps the candidate is supposed to be aware of this.
But you don’t want people who, then faced with a task that can take 3 hours-and has been given time pressure that requires it to take 3 hours—instead spend 12 hours because they can’t live with the ambiguity of being uncertain that they’re using locks the right way.
The approach described in part 2 is highly opportunistic. You generally want to hire staff who can be opportunistic when necessary, even if that is not always the right approach.
(As broken concurrency is one of the worst forms of Heisenbug)
https://www.cold-takes.com/useful-vices-for-wicked-problems/
If thinking about safe concurrent writes is wrong, then I don't want to be writing code for you...
Lawrence immediately saw that it was a trick question. You would have to be some kind of idiot to make the facile assumption that the current would add or subtract 5 miles per hour to or from the speed of the boat. Clearly, 5 miles per hour was nothing more than the average speed. The current would be faster in the middle of the river and slower at the banks. More complicated variations could be expected at bends in the river. Basically it was a question of hydrodynamics, which could be tackled using certain well-known systems of differential equations. Lawrence dove into the problem, rapidly (or so he thought) covering both sides of ten sheets of paper with calculations. Along the way, he realized that one of his assumptions, in combination with the simplified Navier-Stokes equations, had led him into an exploration of a particularly interesting family of partial differential equations. Before he knew it, he had proved a new theorem. If that didn't prove his intelligence, what would?
Then the time bell rang and the papers were collected. Lawrence managed to hang onto his scratch paper. He took it back to his dorm, typed it up, and mailed it to one of the more approachable math professors at Princeton, who promptly arranged for it to be published in a Parisian mathematics journal.
Lawrence received two free, freshly printed copies of the journal a few months later, in San Diego, California, during mail call on board a large ship called the U.S.S. Nevada. The ship had a band, and the Navy had given Lawrence the job of playing the glockenspiel in it, because their testing procedures had proven that he was not intelligent enough to do anything else."
A much more common example is that (particularly young) candidates tend to make job interviews into big, stressful things in their head. Then they don't sleep properly the night before, and during the interview they can't think creatively or access deep memories (which are both well known symptoms of stress). They can't answer your questions. You think its because they don't know, but actually the problem is that they're too stressed to think at all.
Long programming questions work great for my anxiety because I can zen out while I'm programming and forget the interviewer is there. But everyone is very different with this sort of thing.
The more general way to work around this problem is to listen and pay attention to the candidate. If you asked "Lawrence" in this story what he was thinking about during this interview, he'd tell you about fluid dynamics and partial differential equations. That tells a story. Another candidate will tell you that they felt really awkward programming through an SSH connection because they're used to Visual Studio. Or how they really do (or don't) like some aspect of the programming style on display. Or how (to crib from another commenter) the programming was easy enough, but they're worried that doing so introduces a race condition between atomic multiply and add instructions if they're interleaved. And they hate doing the work because they feel like they're introducing a bug.
None of that really helps with stress bunnies, but you learn so much about what sort of employee they'll be by asking.
> their testing procedures had proven that he was not intelligent enough to do anything else
I see the final sentence as entirely detached from the rest of the story.
My take: Their testing procedures had detected he had lacked basic awareness of the situation. When he received a (written!) communication, he wasn't able to imagine that the author was not the smarter version of himself despite a multitude of clues. The idea didn't occur to him.
Man, and that is a LONG book, but I clearly remember that section for some reason.
"Can you understand a complex code base, figure out how to zoom in on the section of interest, and add a function?"
Far, far too many people interviewing for coding positions can't do that. Though I question how many could whip out FizzBuzz in 5 minutes and would then fail the more complex version. At some level, either you can code, or you can't. And, importantly, at some point in your career (if you go down the standard management track), you will typically lose the ability to code. If you've not done it in 5 years, you probably can't do it, in a practical sense. Not that you can't re-learn, but you can't just jump into a coding interview and ace it, either.
If you find yourself at a point in your career where coding interviews are a thing, "having a side hobby project that requires coding" is a very useful way to be really quite good at coding interviews. Plus, if it's your hobby project, there's no "Hrm... can I talk about that?" sort of problems when you're asked about a time you X'd with Y. You can talk about your personal hobby project absolutely as much, and in depth, as you want.
I don’t know a thing about memcached internals but, as presented here, with the potential encoding and concurrency issues means that there’s likely levels to the complexity here that will likely take someone quite a bit of time to resolve if they’re not familiar with memcached internals.
But again memcached and even C++ isn’t my thing. ¯\_(ツ)_/¯
Years ago, I got tired of some owners of a company I worked for hiring bench techs (small business IT support and such) who'd clearly never opened a computer before (I don't know why, but as the closest person I couldn't focus on any of the work I was supposed to do when constantly being interrupted by bench techs), so I "broke" a scrap computer as an interview problem, rather extensively. RAM wasn't seated, a PCI card wasn't fully seated, I think the power switch was halfway pulled off (enough that it didn't work but was visibly wrong), and I did some terrible things to the partition tables as well. The goal, which it succeeded quite well at from my point of view, was to see where a possible bench tech's skills ended, then help them through. If you'd worked on computers a bunch, and one wasn't powering on, "reseating stuff" was a useful enough response, which would either clear the corrosion on some pins or ensure everything was actually planted in place, which would render this machine booting (after you pushed the power button connector back in), and let me observe what you did with some weird boot errors. There were Windows and Linux environment boot DVDs laying around, so, pick what you know.
The result of this was that our next bench tech hire had the skills to do stuff himself, and generally left me alone to do the stuff I was trying to get done.
There already exists a function that does the exact thing the question asks for, handling all the atomicity complexity.
What this comes down to is can the candidate: figure out how to build the project, grep to existing implementation and copy, paste, change a plus to an asterisk. And also, can they articulate the work-to-be-done this simply.
I've never seen the first item in that list tested in an interview and .. I don't hate the idea.
(I realize this might sound sarcastic, but I'm serious. I think the way interview questions are presented is very important, and often overlooked.)
You would not believe how many times I have to tell some people that it's not a trick, I really don't mind if they google something or use `man`. That I'm not trying to trick them into having to know what the arguments of pthread_create are by heart, or that yes they can compile the program in coderpad as many times as they want.
Really unfortunate that so much of the industry thinks interview questions should be like Shyamalan movies.
(also sadly I'm changing jobs soon and I'll have to abandon this question and I don't think it'd fly in the new job's interview policies anyways)
Definitely. That would make it more clear it's about SE and not stupid brain tricks.
Your first clue is it's an interview for a software engineering job.
1. The code would not build at all on a standard linux distro unless you knew exactly what packages to install. (I had an interview like this once)
2. Locking the key was going to be inexplicably linked to the operation (got very worried when I saw `add_delta` and `do_add_delta`). Turns out add_delta just calls do_add_delta wrapping it in a lock. The lock API is very simple.
3. There would be a massive amount of code duplication that would make it difficult to add this feature without doing serious refactoring. Turns out you basically just change `bool incr` for `math_op_t` or something and provide a way to map from binary/string input to math_op_t.
This would be very easy. Depending on how comfortable I was with the editing environment they talk about elsewhere in the hn comments it wouldn't be too bad.
Like do the commands have to be registered somewhere? Is it a string mapping the operation name to a function pointer? A cascading if-then statement? Etc. etc.
It's just a test of diving in and understanding existing code in a relatively short amount of time.
What's the obvious approach? You do have to dig into the source of memcached and understand some internals. With good use of grep and vim it can be done quite quickly, but I wouldn't call it obvious.
I think the main ones are:
* How much about the language the candidate knows. Not the control flow and data types, but how to navigate and where to look for information. And that leads to bellow
* how quickly one can understand a codebase (at least part of it) and start delivering
What else?
If that's one of those "think out loud" tests it's possible to get a clue of how the candidate thinks, but it's not specific of this test.
- Do you understand the problem, or seek better understanding if not? (Obviously the problem here isn’t extrapolating arithmetic, but identifying the importance of an atomic operation.)
- Do you recognize the value of the change, or question it if it feels non-obvious?
- How do you think about approaching an unfamiliar codebase/code path?
- How do you think about the challenges you encountered while working on the problem?
- What else felt important to you that I’m not looking for?
All of these questions provide a lot more information than “can you write code?”
Especially meaningful for evaluating actual fit is reactions to walking into pre-existing code. In fact I think this has been, at least subconsciously, my best heuristic for assessing colleagues’ skill maturity. “Juniors” will stare at a problem or ask a lot of easily answered questions; “mid level” devs will bang their heads trying to answer without asking; “senior” devs will have a good intuition for which challenges are discoverable and which are best solved by asking a human or a google or whatever, or at least for recognizing the distinction after some time exploring the problem.
But probably not what the interviewer wants to hear - maybe.
If multiple clients are simultaneously trying to update the same value, then locking allows them to take turns with relatively little overhead. With compare-and-set, all but one of the clients would fail at the "compare" step and need to retry, requiring additional network round-trips.
Those things are really the vast majority of programming in a professional setting.
* Understanding common coding patterns, and inferring design intent from them
* Quickly prioritizing "critical" vs. "nice-to-have" components of a desired feature (and reprioritizing as you learn more about the implementation constraints)
* Being able to take a partially-complete or slightly buggy implementation, and quickly identify what's wrong with it (e.g. by interpreting compiler errors or using a debugger)
* Gaining confidence in the correctness of code by spending a reasonable amount of time on testing, without going overboard
I have seen people who can talk very nicely, but are lost once they actually have to touch the code. I have also seen people who are really bad at articulating their plans, but are OK with coding them.
Also, the actual time limit (the real author of the question showed up in this thread) was 1 hour. I'd say in actuality it's roughly a 30 minute process.
But THEN, I'd let them actually try to DO it. Because there is a huge swatch of people out there who can describe (and sound smooth about it) but can't DO. And there are also some who can do but don't sound very competent when they are asked to describe.
Many interview techniques never assess the ability to DO coding, presumably because it is more difficult and time consuming to evaluate.
I have seen many times where a user can actually explain the solution to a problem, but the translation from algorithm-to-code is extremely slow, or not done correctly at all. There is real skill in being able to output code quickly, even if you already know the English-language description.
This question has the added benefit that they don’t have to write a whole program from scratch, they have to deal with a real–world program instead of a toy program created specifically for interview purposes, and they have to demonstrate that they can read and understand other people’s code. The latter seems really important to me, as apparently it was to the author of the question, because we spend so much of our time improving code that has already been written instead of writing completely new programs. Of course, I am especially good at these software–archaeology skills, so I suppose I could be biased.
Protip for people in junior roles: if you're interviewing for a more senior position, the correct answer would *not* be to jump in straight and waste 3 hours implementing something that then you have to maintain forever.
The best answer, from an *engineering*[1] perspective, would instead be noticing (or knowing) that memcached supports a CAS command (https://github.com/memcached/memcached/wiki/Commands#cas) that would allow to implement equivalent functionality without changes in memcached, and try to confirm why that would not be a viable solution. If, and only if, CAS is confirmed not to be a viable solution (e.g. excessive contention, unacceptable pX latency, ...) then you should spend the 3 hours (+ all the maintenance effort required until the end of life for that solution).
The risk, in case you jump acritically on the solution, is to show you did not spend any time trying to actually understand the problem and you did not consider the pros and cons of viable alternatives (and this is a problem both during an interview, as well and especially when you're doing actual work), something that is normally frowned upon in senior roles.
Obviously, being an interview, it's all play pretend so you'll eventually have to complete the coding exercise, but if I was interviewing you for a senior position and you skipped the part above it would be a pretty big red flag (same in the unlikely case I were to ask to implement some functionality that is commonly found in the standard library of most programming languages: huge red flag if you don't ask why the functionality provided by the standard library is not a viable solution).
[1]: w.r.t. software engineering being "programming integrated over time" (https://adamj.eu/tech/2021/11/03/software-engineering-is-pro...)
If I were interviewer and a candidate would mention CAS command, I'd compliment them for their memcached knowledge, and tell that the it is not a viable solution. And this would not affect my evaluation of this stage one way or another.
That's the mindset that leads to a crippled code bases. One should always question the methods that arrived to a potential solution. Ideally before spending hours implementing and years maintaining said solution.
I'd hire a candidate that thought outside the box with CAS on the spot, they offer more value overall than a Get It Done fast coder ever will.
It definitely happens (at least it did to me) to be given programming tasks without context. Maybe my comment wasn't crystal clear on this, but I was not providing advice for interviews to the specific company mentioned in the OP, rather general advice for senior roles. In this case the claim that "no one would tell ..." is hard to maintain.
> this would not affect my evaluation of this stage one way or another.
Same point applies here. We all know different interviewers have different ways to evaluate. Therefore it's helpful to cover your bases. Hence my comment to not skip that part. For some interviewers it won't matter, but for others it will be a rather important factor.
> and tell that [...] it is not a viable solution
Just for the sake of discussion: if I were the interviewee I would then definitely ask why it's not viable, and if I did not get a satisfactory answer it would for sure affect my impression of the process and, by extension, of the company I'm interviewing for. Not claiming that every interviewee is like this, just that this is the case for some (I am simply not pretending to be an exception on this).
And memcached isn't going to pull your changes either, because they want a simple protocol. It's not a CRDT-oriented project.
- As people pointed out, it's advanced FizzBuzz (really advanced) - I can easily see a lot of people being unable to solve it, not because they can't do it, but because of a "performance anxiety". The bar here is quite high, and the result is binary (does it work or not). - I like that it is quite close to real life (that people have to read code, figure it out, write code). On another hand, again, what is not real, that you are parachuted into a unknown (quite big) codebase and expect to add a small feature in 3 hours.
That is one of advantages of longer questions (compared to 5 minute one): even if task is not fully done, there are plenty of other signals.
1. Client saves value in local memory. Then issues a command to update the number to a string version of the number (maybe with a flag telling any client to parse it as integer for get). Assuming setting a value is “safe”, this would cause other concurrent clients to error if they are trying to incr (according to example from part 1) 2. Client that did this update now multiplies that local variable. 3. Client updates value to final answer.
If a failure/crash happened you could still sort of retrieve the original value since it is a string version of itself.
Anyway it is hacky and sort of messes up if someone attempts to get the variable while it is a string. So I probably would fail this question.
I took that as a kind of lesson in and of itself. I’ve certainly had to face code monstrosities and cut through multiple layers to discover the simple rewrite before. If somebody had modified instead of extended sooner, if someone assumed the existing solutions were not so sacred, maybe a monstrosity could have been avoided in the first place.
I like that this was a more of an engineering question about diving into an unfamiliar codebase than a gotcha math/algorithm question
The beauty of memcached in the 2000s was that it felt extremely opinionated about features — that is to say, it didn’t have any.
That bool incr argument in the source code feels like a hint from the authors. The arithmetic feature was meant to do two things and two things only, represented by I/D = +/- = true/false. Add (pardon the pun) any more operations and here be dragons. In particular once you add MULT, some clown is going to ask for DIV, and so are you now going to convert ints to floats or force integer division on everyone? Let’s place bets on how long until we get a “bug” report that 12,999,999 DIV 10 should be 13 not 12.
Maybe I’m being unfair. The integer increment thing in memcached seems useful. The useful part of it is the fact that it increments atomically, not that it does the heavy lifting of adding one for you :P If N people increment it you get a number that is N bigger. “Add 1” is also a pretty easy thing to get consistent if you have two people contending for a lock.
If it were a strongly typed language it would have a type like Counter (not Number) and it makes no sense to multiply a counter. The hint is also there in the INCR and DECR commands. They are probably not called ADD and SUBTRACT for a reason.
Feature rejected! Now let’s go code up MULT anyway :)
Inc/dec are useful for a counter implementation (although I see no reason to have a designated dec) - even though counters should not be implemented in such a manner, e.g. each writer should have its own counter, and reader should sum them up when the value is needed. No contention, scalable.
In that regard I'd consider the interview question "weak", lacking a deeper understanding - not just show us you can code.
You'll be pleased to know they aren't called that in the protocol, but they actually are that. They take a delta value so you can do "incr 5" to add 5 and internally the function is named "add_delta" not "incr"[1]. (Beware because it's not quite subtraction, going negative is forbidden. (3 + 5 - 5 == 3) but (3 - 5 + 5 == 5)).
[1] which means the answer in the followup blog post (and my answer) to overload the same function to handle multiplication as well makes the function name even less accurate.
1. This question is heavily biased towards specific software experience and familiarity with the domain and tooling, while at the same time too shallow in terms of algorithmic and logical depth.
It is like asking how to parse a CSV file in Fortran. The difficult part is not the problem per se, it is picking up an unfamiliar language and tooling on the spot.
For example, someone from Windows background who wasn't familiar with the memcached / Linux environment and tooling / Messy open-source codebase might find it difficult to adapt within the time limit. That doesn't automatically make them bad coders. It is like requiring Emacs and DVORAK keyboards for coding at interviews -- In theory it's all the same, but it's cumbersome and slows you down if you are not familiar.
Challenges like this during interviews can lead to high false negatives. People might get stuck on small side things and not working on the main thing enough.
2. This question takes too much time to set up and complete.
Interviewers don't have three hours to wait. Interviewees can probably only do one such problem during an onsite and nothing else. Are you going to make a judgement and decision solely based on the performance of this one challenge? I don't think that's a good idea.
Also the interviewer needs to explain everything. For a three-hour challenge, this is at least 15 minutes time doing nothing but setting the problem up.
3. This challenge is actually not that great to identify senior / great coders while mediocre coders with specific experience can pass easily.
Heavily biased towards the specific software experience and tooling _in use by the company who is hiring_. That seems like a win to me. If you are a Windows shop, go find an open–source C# or VB.net project to use instead.
> 2. This question takes too much time to set up and complete.
You might have missed the part where the candidate is given a VM to ssh into, where all the build tools and dependencies are already installed. Also, the author of the blog misremembered; they were given only one hour instead of three for this problem. There were probably other interviews, and maybe lunch, afterwards.
> 3. This challenge is actually not that great to identify senior / great coders
That’s true. As stated in the article, this question was intended to filter out low performers. Other interview questions would be used to judge other aspects of the candidates.
Leaving fences without questioning why they exist builds tech debt.
I "passed the shit out of this question" and have failed my last several interviews... :( I miss 2010.
The similar but different style question that I got (at Stripe, fwiw) in my recent job search that I also really loved was: Here's a failing test against a complex codebase; figure out what's wrong and then fix it. This flexes similar muscles I think: figure out enough of the flow of a complex codebase to understand where the problem manifests, and how to modify things to fix it without breaking other stuff. The really nice thing is: if all the tests pass at the end, you've done it. Then, time allowing, you can go work on improving the fix; making it more consistent with the architecture, etc.
Both interviewees and interviewers seemed to like these questions. I do hope this approach gets more adoption in the industry. It takes more time to prepare, but the high-quality signals it provides are worth the effort imo. Such questions are also harder to leak compared to typical whiteboard coding questions and thus more reusable too.
This is more or less covered in part 2, and is indeed considered the path to passing.
Only complaint would be the amount of time it may require to do in an interview.
> ”Basically, this question is to software engineers as FizzBuzz is to programmers.”
What’s the implied difference between software engineer and programmer here? I don’t get it.
I can write a pretty good standalone tool to solve a problem, but throw me into an unfamiliar code base and ask me to make a significant change that meets all the necessary style/correctness criteria is a whole 'nother level, at least in an hour interview.
At my first job interview, they handed me the printed documentation for a programming language they invented (2-3 pages), and a problem. I didn't have any work experience with any technology they used, but managed to solve the test, and that was enough to get my first job, and drop out of education.
> Add a mult command to memcached.
I wonder if there's anything to do with the caching function to get better performance though. Will need to think about it more.
If only my teammates had this mindset...
[1] Edit: Looks like it indeed was a filter question, as I suspected: https://news.ycombinator.com/item?id=31065819
I mostly do pair-programming interviews. When I do it async and have them write something, we'll at least discuss the code together. So either way, I'm way less interested in whether they finished than how they did it and how they think about it.
And maybe I'm just weird, but I'm not super interested in the "upper limits of a candidate's abilities". If they're using all their cleverness just to write something, neither they nor anybody else will be able to maintain it. Software is a team sport, so I want people who are good collaborators. Indeed, the "upper limits" thing makes me think of Aphyr's series of fictional technical interviews. (Start with the last one and work your way forward.) https://aphyr.com/tags/interviews
That's what I do most of the time when I'm working with code, it's always an existing system that you need to add a feature to without breaking something else.
What do you think is a good question for a "senior software engineer"?
Good questions aren't easy to come up with, I'm not an expert in interviewing by any means, but for a senior engineer you'd want to ask questions that start straightforward like this, but become progressively less straightforward (and maybe one that's a more subtle design issue) so you can get a better feel for their skills as you work with them.
I'm a senior engineer and I do a lot of design and architecture and code review every day but I would probably fail most generic leetcode tests and I think I would pass this one, so I feel kind of personally validated by that, so excuse the passionate response. :)
There's also a tendency for interviewer to choose questions from their personal expertise rather than something appropriate to the person or role.
You go through the normal change process like everybody else.
There is no such thing as a "safe" change.
The only exception to this is when stuff is on fire, and, practically by definition at that point, there is no such thing as a "safe" change.
- enquiring about the candidate’s thoughts about the problem and their approach to solving it, on which (again IMO) this candidate would really shine; you’d likely get a much less thoughtful or thorough account from someone less experienced or talented
- ask about concerns which would be typical in real world work but often get glossed over in interviews, like how they’d approach testing and SCM and review, or even just things they’d do differently outside the interview process
- get more conversational and learn more about the actual value the candidate would potentially bring to your team/org, starting this with some greater confidence, trust and familiarity on both ends
- dive deeper on technical validation if anything in the above feels questionable
Those sorts of conversations convey much more meaningful information than any coding challenge that isn’t very focused on very specific prerequisites for the domain/role.
It introduces an entire problem space where you’re evaluating something that’s neither important to you or your company.
Way too many moving parts.
I think that this is actually pretty obvious to most people. Arthur only mentions this to say that getting a working build environment wasn’t part of the test.
I haven’t interviewed on site with a coding challenge for nearly a decade, but last time I did I literally brought my own laptop and asked permission to use it (which was always declined). If I were interviewing today I’d literally walk out if that request wasn’t at least considered, and probably even still if it was declined without a really good explanation.
So I never got caught out (EDIT: meaning to be clear caught out unable to solve the problem), which you would expect because in fact engineering interviews are actually no use for interviewing engineers, but in fact are great for interviewing for algorithmists, and you'd expect me to do well because I say I say I'm an algorithmist, and sure enough I did solve all of them. Nobody caught me with my mouth open, I've solved every single interview question without timing out, despite (actually because of) not getting a CS degree from Stanford (which I did attend). No advance prep, although that's bullshit, I spent every second I could on advance prep incidentally by working on algorithms.
But no leetcode. I did look at it once, at one problem, and it sucks, I saw a problem regarding getting the popcount of all the numbers in a range and tons of people got the top 100 points. That's stupid, I knew a superior answer that took morally no time, and would I get more than 100 points for it? Doubtful. There's a very low cap. Not truly elitist. There can't be a max score.
There is one problem that I couldn't get, and that was "how do you find a single element in a list that is not present in an otherwise identical other list?" Like tons of problems, the answer is to sort the lists and take a binary-search analog. That's the answer, but you need faster-than-state-of-the-art sorting. The thing I was supposed to say that they wanted me to say, not to be confused with "the answer", was you had to add the elements and then subtract. I instantly replied, "no, just xor them, less energy." Which was a satisfying response, and marked as a pass. I didn't get the job anyway on a gut check.
Unfortunately I did terribly at the very few jobs at which I did get hired. Because I could only get hired at doomed companies, I had between one and three weeks to prove myself, do or die. Died every time. One place, Unholster, gave me one day to set up my environment, seven work days to prove myself, and after a coworker spent an hour insisting I be fired and the boss saw the stories (epics? The point system thing). Ended up saying I objectively amounted to negative-one-half-a-person, concluded "With your curriculum, nobody would give a níspero for you." Níspero is a plentiful fruit that is sweet and is nourishing, but come to think nobody eats because nobody values it.
And this is NOT slander, well first off it's true and that's all you need legally, but secondly (morally) that's just what a doomed company is like, I'm actually not being negative. They had to fire like twenty people and had two employees left, and that's public information, tells you everything. Like basically all Chilean companies, they had bad Chilean debt, the Chilean bank leaves a tiny glimmer of hope, that's it, they have to grind through meat until they find the savants. Tons of companies like this, in fact I have a relatively high opinion of them considering. Really liked Unholster. They didn't cheat me out of money or time, so above average. And even when they were for sure getting nothing more out of the relationship, the boss agreed to just talking about why my career was fucked, for like fifty minutes. "I would sign [something for you] saying there's better guys at algorithms than you." "Sign what? Sign what, exactly?"
They were hiring another guy, my replacement, I met him, in the time I worked there and he also thought this would be his chance. And it was, I don't know how it went for him, but the point is it is a chance, only it's very very narrow. They wanted to be cool, too, read Hacker News. Smart guys, really good to talk to in the lunch breaks, I liked all of them. They were just living in a shark tank. And truth be told, I wasn't that good at the job, sure if I got three months like everyone's supposed to it'd be easy, but that's really easy, I told them I'd be much better than that. I wanted to be. I wasn't good at the job. Just at the interviews.
And it’s not like you can’t chime in after you’ve done the task to say that you don’t think that the multiplication operation is a good fit for memcached’s role. You might even get extra points for that; nobody wants to hire someone who can’t think intelligently about the tasks they are given. Just don’t blow it by refusing to do the programming task on those grounds; sometimes we don’t get the opportunity to choose every task we work on. Sometimes they turn out to be a bad idea, and yet it is still to our benefit to complete those tasks to the best of our ability.
It's also quite time consuming for everyone involved in the process. A lot of moving parts, where only identifying how to solve the problem is actually relevant.
As for whether the modification “degrades” memcached or not, that is a great thing to bring up with the interviewer _after_ you have taken the opportunity to show off your programming skills.
As an aside, I think atomic incr/decr are useful. I don't see how you would implement them client side without some more complicated mechanism (like CAS).
fizzbuzz is not great, but its also implemented as a stand alone webapp (or console app), not added to an existing codebase.
im not against incr/decr, my point is moving beyond these simple operators is pushing the product into feature bloat territory.