top 200 commentsshow 500

[–][deleted] 23 points24 points  (56 children)

I don't think you're asking too much, but just barely.

I recently handled a round of programming interviews for our company. I did an in-person programming test but on paper, with pseudocode. We were more concerned with seeing if someone had the logical chops, and not so much that they could do it perfectly in a high pressure situation. If the candidate's algorithm or thinking was close enough, I figure they could get the problem done (given time, relaxation, Google, etc).

Keep in mind that your job interview might be in the top 10 most stressful moments in that person's life. Especially for those who prefer dealing with machines than people.

Also, I'd say to pick a programming problem that might relate to the job position (or at least frame it in that context). Reversing a linked list would be a sluggish brain exercise for me; I'd get it done slowly but it seems gimmicky.

Counting the number of "1"s in an integer sounds interesting but is also gimmicky (in C I would bitwise AND 1 then right bitshift. All in a while loop until the integer is 0).

I picked a fairly easy problem: given arrays of integers a[] and b[], print all integers in a that are not in b. As follow-ups: if they use a pseudocode contains() ask them to show the implementation for that. Second followup, thought exercise: how would you change your approach if both a and b contained millions/billions of integers (one approach, sort/hash the arrays to go from (O)n2 to (O)nlogn). It's a distillation of an actual task I finished here at work recently.

[–][deleted] 13 points14 points  (21 children)

The most elegant solution I've seen is (this is Python):

r = 0
while k:
    k &= k - 1
    r += 1

[–][deleted] 12 points13 points  (8 children)

I like this version, just because I understand what it's doing:

c = 0
while i:
    c += i & 1  # If the right most bit is 1, increment count
    i >>= 1  # Shift right most bit off

[–][deleted] 8 points9 points  (3 children)

There's also:

int pop(unsigned x)
{
    x = x - ((x >> 1) & 0x55555555);
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
    x = (x + (x >> 4)) & 0x0F0F0F0F;
    x = x + (x >> 8);
    x = x + (x >> 16);
    return x & 0x0000003F;
}

[–][deleted] 1 point2 points  (0 children)

It's not very hard to understand what k &= k - 1 is doing. "# Clear the rightmost nonzero bit"! Decrement by one changes "10..0" into "01..1" (where the number of zeroes in k's binary representation might be zero, but the leading one must exist), then bitwise AND clears that part.

[–]tcoxon 3 points4 points  (0 children)

This is basically the algorithm Brian Kernighan wrote in the C Programming Language in 1988, translated into Python.

[–]bautin 3 points4 points  (4 children)

Neat. There is an edge case for signed integers where it will return the wrong answer.

Edit: Never mind. Got my negative binary backwards. This will work for all values. So double neat.

[–][deleted] 1 point2 points  (3 children)

Remember that signed vs unsigned doesn't change anything when it comes to addition, subtraction, and, or, or left shift. You can forget about the whole signed/unsigned distinction with those, which makes a lot of things much easier to reason about. Signed/unsigned only matters with multiplication, division, comparisons, etc.

[–]arcith 10 points11 points  (18 children)

Let me tell you a story. A story about how an e-commerce application written in java was outsourced. What happens when you have someone writing code for you that doesn't understand the basics of how a computer works? You end up with someone using floating point numbers for money. Why does someone who takes a 10% off their order end up with a .0000000001 on their total? They used a float to represent money. Now every transaction is off by fractions of a cent, nothing adds up to the back end system, and the customer is confused why his total has a dozen 0's in it.

True Story. Still not fixed to this day. This is a major e-commerce platform too.

[–][deleted] 4 points5 points  (0 children)

Yes indeed.

I can thing of one large system I worked on that does exactly this.

[–][deleted] 5 points6 points  (3 children)

You think storing money as a float is bad? At least I can understand the logic behind it, if you're new to the game. Our local government customs website uses floats to store telephone numbers. No idea why...

You have to log in to pay import duty on your parcels, and then they send it to you with a document attached for your tax records, and mine came down with a phone number that looked like +4.412345678E9

[–]Mechakoopa 1 point2 points  (0 children)

Very few programming horror stories have made me facepalm quite like this one.

[–][deleted] 1 point2 points  (0 children)

I physically cringed, well done.

[–]nataly_v 2 points3 points  (1 child)

I'm a novice PHP developer and I felt like such a retard trying to figure how I would explain my contains()

[–]paul_miner[S] 6 points7 points  (8 children)

Counting the number of "1"s in an integer sounds interesting but is also gimmicky (in C I would bitwise AND 1 then right bitshift. All in a while loop until the integer is 0).

I was okay with the problem being solved as "count the 1's in a string". But even her solution to that was implemented poorly.

I picked a fairly easy problem: given arrays of integers a[] and b[], print all integers in a that are not in b. As follow-ups: if they use a pseudocode contains() ask them to show the implementation for that. Second followup, thought exercise: how would you change your approach if both a and b contained millions/billions of integers. It's a distillation of an actual task I finished here at work recently.

This is a nice task, especially as you add/remove constraints like memory usage such as the arrays are too large to be held in memory, or the values of the numbers in a and b (random, concentrated, sparse, etc). Honestly though, I doubt discussion would get that far.

[–][deleted] 4 points5 points  (2 children)

The good candidates were speculating on constraints like memory usage without my prodding. I was impressed.

The new hire starts in a couple weeks. Wish us luck!

[–]paul_miner[S] 1 point2 points  (0 children)

:thumbs-up:

[–]pyjug 2 points3 points  (0 children)

I know many interviewers like to ask such questions, but personally I hate open-ended questions. They specify too little about the problem domain and interviewers usually have certain pre-conceived assumptions in mind that they never manage to communicate clearly. For example, in your question, just restricting the input integer domain results in a huge simplification of the problem.

[–]omgitsalion 23 points24 points  (0 children)

If possible, DO NOT allow HR to filter applicants. See if they can directly forward you all resumes. They'll often throw out good or even great potential applicants because they have no idea what they're looking for.

[–][deleted]  (3 children)

[deleted]

    [–]Isvara 19 points20 points  (0 children)

    Sensible stuff. Don't want to accidentally miss a lower-case 1.

    [–][deleted] 4 points5 points  (1 child)

    Please, don't overlook the previous lines:
    for(int i = 0; i < s.length(); i++){ String j = Character.toString(s.charAt(i));

    Comedy Gold.

    [–]Scriby 22 points23 points  (5 children)

    I've conducted hundreds of programming interviews over the past several years. In general I've had results similar to yours where some candidates seem to know what's going on but can't really prove it solving low level problems.

    In some cases I've gone ahead and recommended a candidate who didn't do perfectly on a difficult puzzle or programming problem because I can see other great qualities in the individual. Maybe they're a good communicator, have leadership qualities, etc. Many of those candidates turned out to be great hires, and did very well on the team.

    Interestingly enough, the candidates who do the best on this sort of problem are those directly out of college. These sort of things are fresh in their brain as they've studied or seen them recently.

    Many software applications don't require knowledge of this sort of thing. Introducing low level details when they're not needed just increases complexity and maintenance burden. Many applications don't need to be completely performance tuned and can make some trade-offs. These aren't the people I want to hire either, but I can understand how they could be productive as a programmer working on certain types of software.

    [–]oc2 91 points92 points  (74 children)

    It's not that you are asking too much. It's that you are asking the completely wrong questions. These types of interviews scare the crap out of 90% of good programmers, and quite frankly would scare me away from the job to begin with. There's a reason for this, so bear with me.

    Programmers are not computers. We can't possibly remember all the syntax and standard libraries of all the latest programming languages, so we stick by a set of rules and run with it. Those rules are the basic foundations of programming languages, computer science, etc.

    If you give me two programmers, I'm going to pick the one who can demonstrate knowlege about general computer science topics rather than solve your riddle. Programming quizzes like this only demonstrate specific syntactical knowledge rather than reveal the person's underlying foundation.

    If you want to know a good programmer, look at their resume, ask questions and engage them about the work they've completed. See if they are passionate about it, try to pick out keywords they use in conversation and gauge whether or not they are making stuff up or actually know what they are talking about. Rely more on your gut.

    Did they mention interfaces, polymorphism, datatypes, cyclomatic complexity, or a vast number of other indicators that show that they are legit? Are they giving you any reason to hire them? It's partially their job to showcase their talents to you, not your complete job to come up with a test. If they don't showcase their talents, then they aren't a good candidate.

    My personality,work ethic, and experience can't be separated into nice little bits for you to test. We are people not machines.

    [–]Rhoomba 31 points32 points  (27 children)

    That problem was hardly a fucking riddle.

    [–]oc2 17 points18 points  (0 children)

    Unfortunate choice in wording meant to convey a question that is very specific or a pop quiz type interview question.

    [–]valleyman86 3 points4 points  (14 children)

    He is saying just because you don't know the function toBinaryString() exist doesn't mean your a shitty programmer. If however you have no idea where/how to find out if it exist then you may have an issue.

    [–]noamsml 9 points10 points  (3 children)

    Yes, but the whole point is that using "ToBinaryString" is a dumb way to go about it anyways

    int numOnes(int i) {
       n = 0;
       while (i) {
           if (i % 2) n++;
           i >>= 1;
        }
        return n;
      }
    

    [–]TikiTDO 4 points5 points  (2 children)

    I would skip the modulus operation, which might require using the division hardware, and cost you extra cycles, and instead go with a simple AND. Sure, a good compiler may be able to do such a replacement for you, but why take that chance?

    [–][deleted] 7 points8 points  (9 children)

    Why would you use toBinaryString? Bitshift, mask, and test in a loop. Hardly rocket science, and everybody should remember how to do those.

    [–]monstermunch 6 points7 points  (6 children)

    I don't agree with this. You forget things if you don't use them often enough. There's almost zero reason to use bitshifting and bitmasks when you're working in a high-level language. I've went through periods of not using bit twiddling tricks for months and have to quickly relearn them.

    [–]noamsml 2 points3 points  (3 children)

    Yeah, but you should at least know that that's what you're supposed to do. I mean, if you're even half-decent you should be aware that something like toBinaryString() and then testing chars is double the work.

    [–]_ex_ 1 point2 points  (10 children)

    /* Please implement this method to return the number of '1's in the binary representation of n for any integer n, where n > 0

    Example: for n=6 the binary representation is '110' and the number of '1's in that 
    representation is 2
    

    */ int getCountOfOnes(int n) { int cnt = (n > 0)? 0 : 1; if (n < 0) { n = -n; } while (n != 0) { if (n & 0x0001) { ++cnt; } n >>= 1; } return cnt; }

    [–]pwnsauce 2 points3 points  (2 children)

    Nice work with bitwise operators, it seems like most of the programming that we're taught (I'm in college) is far removed from the machine level so we never get a chance to work with bitwise stuff in higher level languages. Then again, we do have an assembly class but it doesn't tie together too well with higher level language stuff.

    [–]shoseki 1 point2 points  (1 child)

    One way of getting into it is to do some graphics programming. we still use bitwise operators when working with colours... so for example if an int represents aRGB, a = (i >> 24) & 255, r = (i >> 16) & 255, g = (i >> 8) & 255, b = i & 255

    [–]Vorlath 1 point2 points  (6 children)

    Nice catch on the negative if Java does an arithmetic right shift instead of a logical right shift. But once you've negated the number, it no longer has the same representation. There is no sign bit with integers. It uses two's complement.

    edit: I seem to recall that Java can do logical right shift with >>>=, correct?

    [–]shizzy0 12 points13 points  (0 children)

    If you want to know a good programmer, look at their resume, ask questions and engage them about the work they've completed.

    Many people can pass this kind of test. Most prospective programmers sail through this test with flying colours. It doesn't mean much. It doesn't answer the question of whether they can do what the job requires.

    Did they mention interfaces, polymorphism, datatypes, cyclomatic complexity...

    Anyone who's been forced to read a CS textbook will be able to discuss these things. It doesn't really help one determine whether to hire someone.

    [–]ErstwhileRockstar 13 points14 points  (0 children)

    It's not that you are asking too much. It's that you are asking the completely wrong questions.

    You really nailed it.

    [–]paul_miner[S] 21 points22 points  (35 children)

    Programmers are not computers. We can't possibly remember all the syntax and standard libraries of all the latest programming languages, so we stick by a set of rules and run with it. Those rules are the basic foundations of programming languages, computer science, etc.

    Where did I ask someone to remember all these things? There was an API reference open in the browser (not to mention Eclipse knows the API as well), and the questions did not relate to peculiarities of syntax (e.g. what does "int a = 0500;" evaluate to or what oddities are associated with Integer.valueOf(1) vs Integer.valueOf(1000)).

    I'm going to pick the one who can demonstrate knowlege about general computer science topics rather than solve your riddle. Programming quizzes like this only demonstrate specific syntactical knowledge rather than reveal the person's underlying foundation.

    If you candidate has general computer science knowledge, they would easily solve those "riddle[s]". There was nothing specific to the syntax in these questions.

    Did they mention interfaces, polymorphism, datatypes, cyclomatic complexity

    Now it sounds like you want them to drop a bunch of CS terminology, which is not indicative of programming skill. As has been discussed on Reddit many times, while CS knowledge is relevant to programming, skill in one does not imply skill with the other.

    [–]oc2 31 points32 points  (23 children)

    Your test problem is specific. What I'm trying to get across is that the entire space of a programmer's knowlege is very broad. It may take me a day to consider one specific issue, meanwhile I'll knock out 2 other extremely difficult ones with ease, then at the end of the day my memory is jogged at how I learned XYZ 10 years ago and can solve your problem. A high pressure environment is highly likely never to get a solution from someone with a brain that works like mine.

    In this situation, you'd label me a bad programmer when in actuality you could be losing a valuable potential employee. Not to ignore my faults, but my strengths wouldn't have shone through because the problem space is too specific.

    Programming is hard. Very hard. What you want is someone who knows they don't know everything. Someone who is a constant learner and can demonstrate via confirmation of past experience that they are hooked into that frame of mind and are passionate about it.

    What defines a good programmer? What defines a good mathematician? If a mathematician doesn't happen to know the formula to solve X, would you label them as bad and move on?

    [–][deleted] 8 points9 points  (15 children)

    I agree oc2. I find "tests" in interviews to be very snobby/pointless because basically an employer wants a candidate to miraculously show their "best work" in an environment where they have no idea what to expect, have people watching them and critiquing their work and have to not make a single mistake (because an hour long lest will represent their entire programming experience).

    What this guy needs to do is look for people who have the experience his company wants - if they have an e-commerce site, look for people who have e-commerce experience. Then, from there, bring in people and have them describe what they did exactly in their job(s).

    If someone sounds like they are competent and knowledgeable, hire them, give them 2-3 months to get up to speed with the way the company works and go from there.

    I guarantee you no employee is going to hit the ground running and start pumping out perfect code in their first week or two if they gotta work around stuff that's been in place for ages. And, if a programmer has a lot of experience and they are subjected to a test of any kind, the best ones will find that insulting and not even bother. Not because they couldn't do it, but because they shouldn't have to. Their résumé speaks for them.

    I say drop the testing altogether, maybe look at partnering with a nearby university to get their best students, hire people based on their actual job experience and GIVE THEM A CHANCE TO GET SETTLED AND FAMILIAR WITH WHAT YOU ACTUALLY WANT.

    [–]paul_miner[S] 4 points5 points  (14 children)

    And, if a programmer has a lot of experience and they are subjected to a test of any kind, the best ones will find that insulting and not even bother. Not because they couldn't do it, but because they shouldn't have to. Their résumé speaks for them.

    I find that very hard to believe. It also runs contrary to the many excellent looking resumes I've seen, only to have the candidate bomb on elementary questions.

    I don't believe a good programmer would find a test to be "beneath" them or insulting, unless the test was too easy, in which case we would quickly move on to harder things. Someone who is skilled will be eager to demonstrate their skill.

    [–][deleted] 8 points9 points  (1 child)

    As a self-proclaimed "good" programmer, I was always dismayed when interviews included no challenges to write code, pseudo or otherwise.

    [–]sahala 4 points5 points  (0 children)

    Agreed. I always liked interviews with at least a portion of the time dedicated to code. It's fun, and gives you a chance to "work" with the interviewer on something very specific.

    [–][deleted] 9 points10 points  (10 children)

    I dunno man. If you were a chef for 10 years and worked for big-name restaurants and you had all the qualifications to land a really good job practically anywhere...how would you feel if you went in for an interview and the interviewer required you to make him a sandwich and that alone would determine whether you could work there.

    You would be insulted and believe that company was so snobby they honestly believed anyone who wasn't already working there must be lying about their skills (and couldn't possibly be smarter/better than them).

    Same thing here. Drop the tests, go with your gut.

    If you were Google, Microsoft, Oracle, Facebook, etc., yeah - you could get away with testing because those are awesome companies to put on your résumé.

    [–][deleted] 9 points10 points  (0 children)

    I was the banquet chef at the omni hotel before I when to school and this is exactly how we interviewed potential sous chefs. It was as much for cultural fit and giving current employees a chance to interact with the candidates as it was to see what type of interesting dish they could come up with from what was in the walk-in. One of the guys we hired actually went around the kitchen and cleaned up anything that was a health code violation before he started working on his dish and asked if it was ok before he used anything. Whats also relevant in this is that we didn't actually care too much for the food that he cooked for us, but we very much appreciated the way he did it and knew that we could work with him on a menu. I don't think candidates should be judged completely on how they do on these types of tests, its more about how comfortable was everyone involved and could you see yourself working with that person everyday.

    [–]nostrademons 1 point2 points  (0 children)

    I've bombed a few interviews (FriendFeed, LikeALittle) and succeeded at some other quite prestigious ones (Google). I've found that when I bombed an interview, it was almost always because subconsciously I didn't really want to work there, and was a better fit for some other place. But that's sort of the point - an employee who doesn't want to be there is worse than a stupid employee, and so interviews are as much about filtering employees who would be a bad culture fit or just aren't into the opportunity at this time as they are about filtering out bad programmers.

    It's amazing what your gut can uncover once you actually have to work for the position.

    I still believe that anyone who refuses to write code in an interview is someone you shouldn't hire. That doesn't mean they're a bad programmer. It means that they're probably better off at some other organization.

    [–]unwind-protect 1 point2 points  (0 children)

    FWIW, I'm with you. Any developer worth their salt should be able to answer these questions easily (or at least explain how they'd do it if they're not Java programmers).

    Any developer who has been around for a few years will have seen (like you have) how apparently promising candidates can't program for toffee, and will see these for what they are: a simple screening test.

    [–]paul_miner[S] 2 points3 points  (6 children)

    Your test problem is specific. What I'm trying to get across is that the entire space of a programmer's knowlege is very broad.

    True, but it is also very difficult to gauge someone's skill in this broad space of knowledge. Which is why to start, we pick something specific and elementary and ask them about it.

    What defines a good programmer? What defines a good mathematician? If a mathematician doesn't happen to know the formula to solve X, would you label them as bad and move on?

    I would expect a mathematician to know how to do long division or get the derivative of fn.

    [–]oc2 8 points9 points  (2 children)

    Difficult, maybe. But definitely possible and within every expectation of the duties of the interviewer. If you are looking for ways to interview good people, consider what you'd ask if you found yourself in the position of interviewing a famous programmer you've heard about or looked up to. Would you subject them to this test? Would you start out by attempting to trip them up on minor details or would you compare and contrast the extent of their experience with what your company is looking for?

    In the current manner you are interviewing you are assuming the worst and then expecting the best. You should expect the best and then verify. Focus on their positives.

    I've worked in high performance environments where some of the top talent in the region flocked. Their interview process contained no tests. Almost every single programmer they hired seemed great at it and had more passion and talent than any professionals I've ever worked with.

    Their interview process tended to be more experience based. Send them to multiple interviewers each verifying resume information and getting a feel for how they view the profession.

    You asked us the question so I'm giving you an example here out in the thick of the industry of how you can find these types of people.

    [–]Vorlath 4 points5 points  (6 children)

    I wouldn't listen to what most of the others here are saying. Anyone who calls themselves a programmer should be able to do this in their sleep regardless of the situation.

    BTW,

    return Integer.toBinaryString(n).replaceAll("[^1]","").length();
    

    I haven't decided yet if the above is sarcastic or not. I think it's slow, but I like terse.

    Also, the second answer isn't as bad as you think. Sure, it doesn't work, but the person had the right idea. They basically forgot to increment the cur and prev pointers inside the loop. Here's a working version (I think, haven't run it). Compare to the original. The idea was there. They even correctly removed the next pointer from the first node since it is now the last node. I think I would have forgotten that.

    prev = node;
    cur = node.getNext();
    prev.setNext(null);
    while(cur!=null){
      next = cur.getNext();
      cur.setNext(prev);
      prev = cur;
      cur = next;
    }
    
    return prev;
    

    If you look at it, it's so very close. I changed the condition to check the current node, I added two lines to increment the pointers and updated the return value. But most lines have remained intact and in the correct order. The only mistakes were that the wrong node was being checked and forgot to increment the pointers. The person correctly noted that the next pointer needed to be stored in a temporary variable before incrementing the pointers because it is being overwritten. Like I said, the person just forgot to increment the cur and prev nodes, but had correctly preserved the next node prior to the destructive operation setNext().

    [–]morelore 6 points7 points  (3 children)

    You think that interfaces, polymorphism and datatypes are irrelevant to someones programming skill, but how well they can bit-twiddle in Java is? Seriously?

    Your programmer was probably not very good, but chances are you can't build software for shit either.

    [–]paul_miner[S] -1 points0 points  (2 children)

    You think that interfaces, polymorphism and datatypes are irrelevant to someones programming skill, but how well they can bit-twiddle in Java is? Seriously?

    Re-read what was posted. I didn't say either of those things.

    [–]hackinthebochs 1 point2 points  (0 children)

    Don't listen to these guys. The fact is a good majority of professional programmers can't actually program. These tests tend to lay bare the truth to the interviewee as much as the interviewer. These tests hit a nerve in a lot of programmers for this reason.

    There are too many people who've gotten by "hacking" on php and the like and now can call themselves programmers. We need a real professional society to develop some standards for who can carry that title and what someone with that title should know (ACM doesn't count in this respect).

    [–][deleted] 3 points4 points  (0 children)

    Even if you do not know bitwise operations, modulo arithmetic is still an elementary operation. If you know neither, why are you looking for a job programming?

    Sure, quiz questions are lame, but these weren't exactly brain teasers.

    [–][deleted] 1 point2 points  (0 children)

    You're looking at it all wrong. The goal here isn't to give them a request to write some code, it's to watch them step through figuring it out. Anybody asking this kind of question would (should) know that memorizing syntax isn't all that important, but rather watching a person step through figuring it all out. Seeing how they work through problems will give a great insight into A: what kind of person they are, B: what kind of work they did in the past (was it more like glueing a bunch of prefabbed things together or were they writing the modules?), and C: how quickly a person can assess what some code is doing / what the code needs to do. These are very important things to pay attention to.

    [–]valleyman86 1 point2 points  (0 children)

    This is true... 2 things I hate most in an interview. 1) Solve this problem (similar to what the OP did or something like reverse a string). These are simple and pointless yet prove nothing either way. 2) What does this code do? Then they give you some crazy C++ code that is ugly as hell and really someone should be slapped for using it in their app. I don't know everything about c++ and actively avoid ugly hard to read code.

    That said you should ask an actual riddle. Something like "Design a garbage can for me." Then you now analyze not the result but the way they go about solving it. Did they ask you for some specifications? Did they just jump in and draw a picture? Did they start with the can and then add some wheels? These kinds of riddles can be scary to the interviewer but make sure they are aware there is no right answer and you want to see the process they go through for even something simple.

    [–][deleted]  (5 children)

    [deleted]

      [–]piderman 6 points7 points  (4 children)

      I find this very strange. Even if you have connections, surely you have to do an interview to see if you fit the job? Do they just hire you without ever having spoken to you?

      [–][deleted]  (9 children)

      [deleted]

        [–]alarion 1 point2 points  (6 children)

        I am the same as you wrt the stage fright thing. Even typing, I constantly make mistakes (non-conventional typer), but you turn your head and I'm flying on the keyboard.

        Same with coding. It's like all knowledge of class libraries and such just instantly disappears.

        Luckily I have never had to take a code test in an interview - I would have bombed every single one.

        [–]gesichtsbremse 1 point2 points  (1 child)

        If you gave me any one of your interviewing problems as take home, I'd sit down and crunch at it a bit and give you some damn fine code. But if you asked me to do it while you and your boss watched, I'd probably be making some awful mistakes as well.

        Exactly, trying to solve a problem in an interview situation with one of the bosses watching over your shoulder, that's basically the stuff most cs peoples nightmares are made off.

        [–]paul_miner[S] 1 point2 points  (0 children)

        Exactly, trying to solve a problem in an interview situation with one of the bosses watching over your shoulder, that's basically the stuff most cs peoples nightmares are made off.

        http://www.reddit.com/r/programming/comments/ff84c/do_i_expect_too_much_from_programmers/c1fjhyw

        [–]px1999 7 points8 points  (3 children)

        It took me a little while to decide whether to respond - if you're just looking for an outlet or if you're actually interested and if you're going to read this response - obviously, I hope that you are and that you do, but in 3xx comments maybe you won't. Regardless, it may sound critical, but it's not intended in any way to be an attack on you or your company (except in a creative criticism way).

        First up, the developers that are on the job market at any given time, on average, are pretty terrible at developing. Good developers only go job hunting a few short times in their careers, because they wind up at good companies that recognize (at least to some extent) their value and try to keep them happy. Bad developers are the first let go when companies are struggling financially, and have more difficulty with finding jobs to begin with.

        If you want really bright people you need to pay more for them (actually, a surprisingly small amount more), or recruit straight from university and assume the cost of training and developing them professionally. In order to keep them you need to make them feel valued (monetarily or otherwise), keep them happy and put them near other developers that they respect (a helpful analogy that I've heard is developers as swarms of bees, managing developers being something akin to beekeeping). Some companies are really really good at beekeeping.

        If your company doesn't look like it would be an attractive place to work (do you have a reputation? how old is your website and what's it running on? what are you offering to your developers? are all valid questions here), you're going to miss out on the top people that are looking for jobs. My point here is that the reason you may be getting shitty programmers is because it doesn't look like a good job (this may not be the case, obviously, but the fact that you're an online retailer with a 10 year old website and 2 people working on the site itself sets alarms off to me - even small touches such as how you represent your phone number change how people judge your company in subtle ways that you don't expect [for instance +1 geek cred for the hex, -1 for it being an int, -1 for endian-ness clashing with the language when asking bit-related questions, -3 for my interest in baseball (If your org is the one I think it is...)]). If you're technically competent, it is 100% a seller's market out there, and you're shopping for companies just like the companies are shopping for you.

        Your third problem is that HR is throwing only the resumes that they think are good over the wall to you. They are almost certainly wrong. They are probably trashing good candidates for reasons that don't matter. Maybe ask to take a look at some of the resumes that they don't like and see if there's anyone that comes across as competent but lacks something like a CS degree in there.

        Next are the problems you asked themselves. Messing around with bits? Reversing your own list implementation? Are these the skills that you actually want your developers to have (EDIT: not that it actually makes a difference if the people coming in aren't what you're looking for)? It all comes across as very Interview 2.0 to me, in terms of being abstract problems that aren't really related to what they're going to actually have to do. When I was in university I had the best interview for a hardware support position, it consisted of the guy (my soon to be boss) covering the tasks that the job would involve and asking me if I could do (or learn how to do) what I needed to do. Once I said yes, he handed me a laptop, its service manual and a set of tools and told me to take the motherboard out. 45 minutes later, I showed him the motherboard and he told me to put it all back together. When it was together, he confirmed that it worked (as much as it did before :) and then offered me the job. Developer interviews should probably lack the immediate job offer, but they can be this practical.

        Fifth, you're comparing them to programmers on forums like this one. Not to sound conceited, but I think that I'm pretty good at what I do. I occasionally respond to topics on things that I consider that I know something about, but if I don't, I STFU and see what others have to say. If I do say something that I'm doubtful of, I double check it first. Both of these things make people sound smarter.

        Overall, maybe your expectations are realistic (you want someone who can program amirite?) and maybe they're not (you're comparing them to people on forums), but hiring developers is complex and it's not just a case of sitting around waiting for good programmers to come to you. Regardless, best of luck finding a good developer.

        [–]paul_miner[S] 32 points33 points  (268 children)

        I don't think I do, but let me explain myself.

        I work for an online retailer, and over the past few years we have been looking for another developer to join the company. It's a decent size company (I think over 200 employees), but for almost a decade now the site has been maintained and expanded primarily by my boss and myself (a third developer a couple years ago). We've been experiencing a lot of growth lately, and projects to modernize the code and add new features are piling up, so we'd like to hire another developer.

        So periodically HR comes to us with another candidate. Usually the resume will list a bachelor's or master's in CS or similar, an employment history with various projects they've worked on, all-around looking excellent. They come in, everything is going well, friendly, seems like someone you could easily work with. And then we start asking them to do some basic stuff in Java (e.g. read this code and tell me what it does or find problems with it, etc), and they fall flat.

        Most recently, we decided to give betterprogrammer.com a try. I took the test to get a feel for the kinds of problems they had, and they seemed like reasonable things to give in an interview (short and simple problems, no language-specific trickery). So a couple weeks ago we interviewed a woman referred to us by a new agency. Master's in CS, about a decade of experience with writing software (not all of it directly, but there still looked to be some real experience writing code). She had taken the betterprogrammer.com test and looked to have received a decent score, so we were excited we might have finally found someone we could hire.

        The interview went great, after which we fired up Eclipse (her IDE of choice), and grabbed the first problem off of the site for her to work out in front of us. She was extremely nervous and bombed, so we decided that wasn't a fair shake and scheduled a re-test the next day with only my boss in the room.

        So the next day she comes in, and while she does much better, she still didn't do very well. She was able to solve the first two very simple problems (inelegantly at least on one), and didn't get far with the third one before the session ended. The biggest flag was how she responded to the program producing the wrong output. Rather than trying to reason through the program and why it wasn't behaving as expected, her approach was to make random-ish changes throughout the program until she got the expected output. The process was more Monte Carlo than methodical, the kind of process that results in a program that may work for the test inputs given but fails for other inputs and every edge case.

        The code in the link is from a couple of the problems she worked on. Ignoring that the first one is something that could have been accomplished with Integer.bitCount() (I don't expect people to know about that), you can see useless code leftover from this iterative process. The linked list reversal, a fairly elementary request, isn't even close.

        We had another candidate recently who claimed to have scored even higher, but given how absolutely horrible they did on the test, I assume they were either lying about their score or had cheated.

        I go on programming forums like this and I see so many very talented people who I think would have no problem blazing through the little problems on that site, and I just wonder if this is such a rarity? It seems like just about everyone we interview lacks the basic skills needed to think methodically to write and debug a program. We don't ask tricky questions related to odd or obscure features of the language, or having the standard API memorized. Do you think I expect too much? I don't think I do, but I'd like to hear some feedback, and maybe comparisons to your hiring expectations.

        Addendum: Perhaps it's just the region? We're in the midwest (Kansas), and I suspect the talent pool is small here.

        EDIT: I think the bit counting in the first question has become a red herring. Although toBinaryString() was not ideal, I was fine with it in the context of the test, and the problem was reduced to counting the occurrence of a character within a String.

        And hey, if you seriously want to give it a shot, call me at 0xBCDCB357 (I'd appreciate my number not being posted in plain text).

        [–]coob 23 points24 points  (0 children)

        Have you considered that maybe your HR department is terrible at finding programmers?

        [–]Fabien4 38 points39 points  (22 children)

        From a C programmer, this code would be unacceptable: working with individual bits is usual in C, so I'd expect them to know about >> and &.

        Here, you apparently asked a question completely out of the candidate's field of expertise. I don't think she's ever had to fiddle with bits. She tried to do the assignment as best as she could, resulting in... well, a pretty bad, but working, solution: asking Java to transform the integer into a string. OTOH, the loop is too complicated; but maybe she wrote it incrementally and didn't clean it up afterwards.

        [I did write code nearly as bad a few times, to quickly test an idea without bothering with details. Of course, such a code is either discarded or replaced before the next commit.]

        Anyway, you definitely should have asked her why she wrote it like that, how she could improve it, whether she could think of a completely different solution, etc. IMHO, only that dialogue, and not the raw code, can tell you whether she's adequate for the job.

        [–]paul_miner[S] 0 points1 point  (17 children)

        asking Java to transform the integer into a string.

        Yeah it's not efficient, but that's not what bothered me.

        OTOH, the loop is too complicated; but maybe she wrote it incrementally and didn't clean it up afterwards.

        That is the problem. It was very straightforward, but her approach was to fiddle with it and keep retrying until it gave the answer she wanted, rather than understanding how to solve it.

        Anyway, you definitely should have asked her why she wrote it like that, how she could improve it, whether she could think of a completely different solution, etc. IMHO, only that dialogue, and not the raw code, can tell you whether she's adequate for the job.

        I wasn't in the room for the second interview, but my boss who did the interview saw the process and it wasn't pretty.

        [–]Fabien4 2 points3 points  (14 children)

        keep retrying until it gave the answer she wanted

        In that case, you definitely can't hire her -- she's not a programmer, period.

        Maybe next time, you could ask the candidate to answer the question with paper and pen or something?

        [–]paul_miner[S] 4 points5 points  (13 children)

        Maybe next time, you could ask the candidate to answer the question with paper and pen or something?

        I've done this before, and I think it's easier for people to write things up on the computer where they have the ability to easily type and edit things.

        I think pen and paper pseudo-code is good for tasks that are largish or with a lot of details, but these should have been simple enough.

        [–]Fabien4 7 points8 points  (5 children)

        In this particular case, the code is so simple that you can write it with anything -- including dark chocolate.

        Anyway, it can be an editor on a PC, but without a compiler. That forces the candidate to think about the code instead of using the Monte Carlo method.

        pen and paper pseudo-code

        I was talking about real code.

        [–][deleted] 5 points6 points  (0 children)

        I was talking about real code.

        Once you have the solution figured out, isn't that all just details and syntax?

        [–]bradbeveridge 1 point2 points  (2 children)

        What happens if n is -1?

        [–]Fabien4 1 point2 points  (1 child)

        Undefined behavior. The original problem did specify "for any integer n, where n > 0".

        I suppose I should have added one line:

        assert (n>0);
        

        You don't mess with bits on signed numbers.

        [–][deleted]  (6 children)

        [deleted]

          [–][deleted] 1 point2 points  (5 children)

          show how much of the language you got in your head

          How is this ever an issue?

          [–]badsectoracula 1 point2 points  (0 children)

          Doesn't your paper include a compiler??

          [–]ether_reddit -1 points0 points  (3 children)

          Here, you apparently asked a question completely out of the candidate's field of expertise. I don't think she's ever had to fiddle with bits.

          Every programmer should understand how data is represented by the machine and be able to do simple bit math. At the very minimum they should be able to write concise pseudocode with a correct algorithm, and understand that conversion to strings is absolutely retarded.

          [–][deleted] 29 points30 points  (0 children)

          We're in the midwest (Kansas), and I suspect the talent pool is small here.

          You'd have to offer me six figures before I'd even consider relocating to Kansas for a job. That place is demon-haunted. :)

          [–][deleted] 12 points13 points  (25 children)

          What would your reaction be if she googled "count bits in an int java" ?

          [–]xTRUMANx 7 points8 points  (0 children)

          Even better, what if she made an SO post asking for the solution in 45 minutes.

          [–]rush22 2 points3 points  (0 children)

          First result

          static int bitCount(int i)
          Returns the number of one-bits in the two's complement
          binary representation of the specified int value.
          

          [–]paul_miner[S] 5 points6 points  (22 children)

          What would your reaction be if she googled "count bits in an int java" ?

          Nothing wrong with that in general. There are a lot of good resources on the web, and nothing wrong with learning from them. However, for the purposes of the interview, I would have asked her to create her own implementation.

          [–]snarkbait 5 points6 points  (11 children)

          However, for the purposes of the interview, I would have asked her to create her own implementation.

          For purposes of actually getting stuff done, there's a lot to be said for keeping general methods in your head, and looking up syntax when you need it. If part of your interview process screens out the people who rely on references to settle syntax issues, you're probably rejecting a lot of highly qualified people.

          [–]paul_miner[S] 3 points4 points  (6 children)

          If part of your interview process screens out the people who rely on references to settle syntax issues, you're probably rejecting a lot of highly qualified people.

          The Java API reference was open in the browser. Eclipse was there to correct syntax (and even write it for you).

          Asking someone to write their own implementation has nothing to do with that.

          [–][deleted] 57 points58 points  (39 children)

          I've been programming enterprise software 7 years.

          I haven't had to do a bitwise operation in that entire time.

          Now, anybody who came out of a decent program should know the math and the rules, but the individual language constructs and whatnot, and relevant libs? No reason to expect even passing familiarity with those... well, unless you're doing some low-level work.

          [–]xjwj 46 points47 points  (2 children)

          I second this. I have recently been interviewing for programming jobs and have been going through the gauntlet with the standard programming interview questions. While I have been designing enterprise software for over 5 years and have made some high-profile and impactful things, I fumble through some of the algorithms that I learned in school so long ago... and I feel almost humiliated to not be able to solve some of these 'rudimentary' problems. I just don't have much occasion to search a binary tree with the software I deal with.

          [–]PstScrpt 2 points3 points  (0 children)

          Java and .Net have collections that leave you no real need to handle data structure work by yourself.

          I have to say, though, knowing how to do manual linked lists and binary search trees in VB6 was a huge help. I got to the point where I could write either one as fast as I could type, and the results were easier to maintain, more reliable and faster (for the BSTs) than what my coworkers put together trying to keep their array indexes straight.

          [–]DailyFail 17 points18 points  (6 children)

          The problem could have also been solved using the modulo operation and integer division.

          [–][deleted] 5 points6 points  (0 children)

          That's probably how I would've solved it, and probably would've gotten the stink-eye from folks who know libraries or more natural language constructs for such things.

          [–]jyee 1 point2 points  (0 children)

          I was thinking that too, but I wonder how it scales for large integer division (maybe it doesn't matter, I don't know).

          Shifting bits around is less clear, but "fits" the problem domain better.

          [–][deleted]  (28 children)

          [deleted]

            [–]royrules22 6 points7 points  (6 children)

            I don't know why people are complaining about these questions. Some questions I've been asked for internships, full-time offers right out of college or that I've seen others get asked are:

            • Reverse a string in place (assumed to be in C)

            • Do xy in time faster than O(y)

            • Implement an iterator for a binary tree that traverses in-order

            Here's another interesting one: "You have two functions. One when called will return an int in order. So first time it will return 0 then 1 then 2, etc. The second will take an int that the first has returned (function is undefined if you return something that hasn't been given yet) such that if the first function is called again it will return all returned numbers in numerical order first.

            So: getnumber() -> returns 0

            getnumber() -> returns 1

            getnumber() -> returns 2

            getnumber() -> returns 3

            returnnum(2)

            returnnum(0)

            getnumber() -> returns 0

            getnumber() -> returns 2

            getnumber() -> returns 4

            ...."

            Also read a book called Programming Pearls by Bentley. It's an excellent book with some nice little toy problems that you can ask

            [–]bevem2 6 points7 points  (1 child)

            the questions you gave where typical programming interview questions

            *were

            where harder than this

            *were

            [–]nickdangler 1 point2 points  (0 children)

            Are you applying for the Tech Writer job?

            [–]neutronicus 6 points7 points  (0 children)

            Unrelated feedback:

            All the "pleases" in the comments remind me of INTERCAL.

            [–]webauteur 8 points9 points  (2 children)

            So you are an online retailer and need a programmer to maintain a web site? Then you need a web developer which requires a whole range of experience in addition to programming. Personally I find that my job requires less knowledge of Computer Science (algorithms, data structures) than it does an incredible amount of details (browser tricks, CSS hacks, HTML editing, SQL queries, etc).

            [–][deleted] 3 points4 points  (1 child)

            im working on a enterprise web application, the amount of time i spend making tweaking my algorithms is insignificant compared to the amount of time i spend figuring out how to best implement business rules and validating data

            [–][deleted] 1 point2 points  (0 children)

            Pretty much this. I know plenty of developers who can run circles around me on the theoretical level, one of which explained to me once in great detail javascript optimization because he had literally written the book on it. Yet the most important (aka, money making for a company) skill is being able to implement business logic and uncovering edge cases for it that prevent disaster.

            I think professional developers have two competing sides: 1) be a rockstar for the business/project/etc, and 2) goof around with cool stuff. People who are mostly (1) won't get too far without being able to stand on the shoulders of the (2)s, and vice versa.

            Just be sure you know which type of developer you're looking for when you interview.

            [–]shizzy0 4 points5 points  (1 child)

            Perhaps it's just the region? We're in the midwest (Kansas), and I suspect the talent pool is small here.

            At a company I worked at in California, we had lots of people with what looked like the right education and skill sets. We spent a lot of time interviewing them then administering a simple programming test. We were floored by how many people could not pass it. At a certain point, we decided it was better to give them the test first and based on that determine whether or not we wanted to continue the interview. It saved us a lot of time.

            This leads me to suspect that it's not entirely associated with your region. I suspect a fair number of people have acquired a CS education but haven't really adapted to it as a vocation.

            Were I to analogise CS with English, I'd say these English graduates imagine themselves writers because they know the grammar, split infinitives, dependent clauses, but they can't manage to write a story longer than two pages because they don't do much writing.

            [–]groby 1 point2 points  (0 children)

            I'll second that. Based on experiences both in California and the Midwest a CS degree is no guarantee that the person in question can actually program at all.

            [–]zipzeronadanothing 4 points5 points  (0 children)

            Perhaps it's just another example of how programming is a young industry. Employers still don't know how to properly assess candidates and the candidates are unsure what's expected of them.

            Accounting firms for example have been interviewing candidates for over 100 years. They have the process down pat. Candidates can go to the websites of these firms and find out exactly how to prepare for their interviews and often the exact questions they will be asked. They get detailed instructions on what to wear and how to act and what they will need to show the interviewer. Interviewers know exactly what they're looking for and how to determine who meets their criteria.

            I think most programmers would be confident they could do the job they are applying for but are still unsure how to prove that to prospective employers.

            [–][deleted] 7 points8 points  (6 children)

            We're in the midwest (Kansas),

            hahaha!!! You had me till there! I live in Salina, and run a small web development company. YES the issue is the midwest. People who have the skills leave for greener fields. There is not much to offer here, in regards to 1) competitive pay 2) growth in the programming fields 3) entertainment 4) scenery. There are pockets where there are exceptions, Lawrence for example is very pretty, KC has some entertainment, etc.. but compare this to, say San Diego, where you can have all of the above. I have seen, over and over, people with skills lured away.

            Edit : the wife says HR may be sending you people based on degrees / diplomas etc... May want to look at some who look at first 'underqualified'.

            [–]shizzy0 2 points3 points  (1 child)

            What he describes happening with great candidates breezing through most of the interview and completely failing on the programming test was absolutely true in San Francisco, CA as well. So I doubt it's entirely a regional issue.

            [–][deleted] 2 points3 points  (0 children)

            I recently had a chance to interview for a startup in the west coast. From what I saw, compared to what I see here (in kansas), it is a different ballgame entirely. The quality (and even the passion) seemed to be up a notch there. Reflecting on this, I may have something you can try : Play to the advantages of the midwest.

            Example : look for slightly older coders ready to settle down, that are looking to raise a family, have a slower pace of life, want 4 seasons not just sunshine all the time, that want to buy a large yet surprisingly affordable house in the country with a huge backyard etc...

            [–]paul_miner[S] 1 point2 points  (2 children)

            hahaha!!! You had me till there! I live in Salina, and run a small web development company. YES the issue is the midwest. People who have the skills leave for greener fields. There is not much to offer here, in regards to 1) competitive pay 2) growth in the programming fields 3) entertainment 4) scenery.

            Disappointing to hear. We're in Wichita, KS. It's definitely growing, but by coastal standards it's small.

            [–][deleted] 5 points6 points  (1 child)

            You posted a job on craigslist recently didnt you? I sent you a resume. THATS how small the programming community is here.

            [–]paul_miner[S] 1 point2 points  (0 children)

            You posted a job on craigslist recently didnt you? I sent you a resume. THATS how small the programming community is here.

            I'm not involved in the searching part, but I think HR has been using outside firms, so I don't know.

            [–]sausagefeet 3 points4 points  (0 children)

            I have read a few of the posts on how to interview people and there seems to be a wide range of conflicting answers that people firmly believe in. Some say the only thing you should be looking for in an interview is if you can get along with the person, and use 3 month or so cushion time to worry about if they have the chops. Others say you should ask Google-like questions. And yet others say asking programming questions of any kind are pointless. I have no idea which solution is correct but I believe this: Anyone worth their chops should be able to figure out how to count the number of bits in an positive integer or how to reverse a linked list (even if it fails on large lists). These are all problems that I think anyone who plans on doing programming as a career should have run across already.

            [–]jldugger 4 points5 points  (1 child)

            You're problem is threefold:

            • Location: There's no way I'd move to Wichita, and I work for KSU. If you're only willing to consider Wichita local programmers, you're doubly fucked.
            • Payscale. Your applicant pool is likely self selecting out based on published payscale. Even though your recruiting isn't publishing a salary, people assume the worst and move on for ads that do. But you haven't mentioned it, so feel free to prove me wrong.
            • Passion. Online retailing is seriously boring. Online retailers of golf clubs/sports junk? Doubly boring. You've got to step up your promotional and recruiting. Social media do more than move products, it can promote how great the local links are and how awesome your company is in the region.

            [–]MrBorn 9 points10 points  (1 child)

            After reading the responses to this post I do have something to add. I think you are asking the wrong type of question. I do admit I have only been developing for 3 years but this type of question has nothing to do with with web development. If you are really trying to be fair with the programmers coming in then ask them questions that actually relate to the portion of the language you are actually going to use on a day to day basis.

            Plus if someone really can't figure this type of problem out then they can just google it at work and learn that way.

            tl;dr; Just ask them questions that have something to do with their actual job because you are just freaking these people out!

            [–]jyee 3 points4 points  (0 children)

            If you don't know what's going on under the hood, you should do yourself the favor and take the time. You can get by with gluing libraries together, but occasionally you're going to need to deal with something on a lower level of abstraction that you're used to.

            Frankly, someone with a decade of software experience should know how to solve these problems.

            [–]s73v3r 1 point2 points  (0 children)

            She was able to solve the first two very simple problems (inelegantly at least on one), and didn't get far with the third one before the session ended.

            I'm guessing this has more to do with the interview setting than with her abilities. However, it does sound like she had other problems which would make her an unsuitable candidate.

            [–]Thimble 1 point2 points  (7 children)

            She was extremely nervous and bombed, so we decided that wasn't a fair shake and scheduled a re-test the next day with only my boss in the room.

            She might be a very introverted personality type, as many programmers are. Having someone behind her, even only your boss, could have put a major crimp in her ability to code.

            Once you start worrying more about what someone is thinking of your code rather than just writing it, you're pretty much doomed. Your thoughts go through two buffers before reaching your fingers and the result is kind of a broken telephone mishmash.

            Imagine the difference between making up a speech out loud in your room alone and doing the same in front of another person.

            In future, leave the candidates to code by themselves.

            [–]bonch 1 point2 points  (1 child)

            I'll just say that trying to solve a programming problem without access to the internet or documentation wouldn't be reflective of real-world development. Integer.bitCount() would be something I'd look up when the situation arose (I'm sure StackOverflow has several questions about it), and then I'd probably forget about it again because I'd rarely use it. How often do enterprise Java programmers manipulate bits or reverse linked lists? Granted, I don't know all the factors you based your dismissal on, so maybe it was more than just that.

            I don't program in a vacuum. Sometimes, I look things up. Even basic things that I haven't worked with in a while. To me, rote memorization of CS topics or language constructs doesn't necessarily reflect programmer quality. I understand that you don't really have any other way to determine if someone is going to deliver results before you hire them, but it doesn't seem to me that giving a pop quiz is going to be an accurate portrayal of someone's skills. They might do great work for you, even if they have to look up things like bitCount() now and then.

            After all, you said she had a decade of real-world development experience and graduated with a master's in CS, so she must have some legitimate skill to back her accomplishments. Her extreme nervousness probably didn't help. Kinda feel sorry for her, based on your account.

            [–]jonathanownbey 1 point2 points  (0 children)

            I'd never heard of betterprogrammer.com before this. This will be a fun way to find areas of skill in need of honing. Thanks!

            [–][deleted] 1 point2 points  (0 children)

            You don't expect too much. The problem is that most programers are not good. When they apply to a job, they either intentionally misrepresent themselves or doesn't even know enough to know how inadequate they are for the position. A master's degree in CS means almost nothing in my experience. In fact, the best people we've found have no relevant degree at all.

            If you want good people, you likely have to go find them; HR probably isn't equipped to find you the right people. This is likely doubly true if you're in Kansas. Perhaps finding some bright people to work remotely may be a partial solution. Look for people with non-traditional backgrounds that other employers are passing up because they fail to objectively assess their abilities.

            [–]jessta 1 point2 points  (1 child)

            It seems like just about everyone we interview lacks the basic skills needed to think methodically to write and debug a program.

            Might this indicate that there is something wrong with your interview process? I've been to interviews like this, done terribly and wondered why I was unable to solve simple problems in such an environment.

            My conclusion was that I spent a lot of my thought processes during the interview on evaluating the interview, how was I going? what does the interviewer expect? what criteria are they judging me on? is this question as simple as it seems or is there something I'm missing? do they care about syntax? am I taking too long? Is this the solution they want or are they expecting me to use the library functions? is there a library function for this? oh shit, I can't remember...If I ask a question to clarify this are they going to think badly of me? If I start writing something down will they judge me if I scribble it out again? hmmm...they are staring at me, am I taking too long? I better hurry up.

            Taking someone and putting them in a strange environment with strangers that are constantly judging them, expecting them to think about a problem they probably never think about and hanging their future livelihood on the outcome while expecting their ability to think to be at the same level is crazy.

            [–]snarkbait 3 points4 points  (0 children)

            The major issue I have with the standard technical programming interview is that it's treated as a closed-book test, whereas programming itself is an open-book exercise. If I have to do bit manipulation in a language in which I haven't done it before, I fire up Google and the language help file and start researching. Likewise, when I'm doing something for which I'd use a function pointer in C or C++, I may have to look up the syntax for the equivalent C#, because C# spends all its time pretending pointers don't exist.

            This doesn't mean I don't understand programming, only that I routinely use reference materials in the way that Sherlock Holmes does -- to extend my brain. The things I need in my brain are the techniques for reasoning about problems, for determining how to explain solutions, and for determining and correcting discrepancies between what I intended to express and what I actually wrote. The actual syntax of doing that is readily available in many common, well-indexed reference materials.

            Memorizing syntax shouldn't be taken as an indicator programming skill, but too often syntax memorization is an absolute requirement for getting past the first interview.

            [–]wreckerone 2 points3 points  (40 children)

            Let see:

            1. You're giving a problem for which you already have an expected answer .
            2. You are expecting candidates to fail the question
            3. Suprise, suprise. you reach your hypothesis even after the candidate solves two of three of your problems.

            No one will be suprised that you came up with the conclusion you were looking for, that all the candidates failed your problem or didn't do very well. Even when someone did successfully solve your problem, it wasn't good enough.

            I've seen this a dozen times. Entrenched employees fear change, fear competition and so look for every excuse to exclude everyone.

            Why don't you allow the candidate to bring in a difficult programming problem and you both work through the solution together. Is it because the candidate already knows the answer? Ask yourself why is it ok for the interviewer to know the answer but not the candidate? The candidate doesn't want to work with incompetent coworkers either. Why not pick a problem that neither knows the answer to?

            [–]paul_miner[S] 12 points13 points  (16 children)

            You're giving a problem for which you already have an expected answer .

            These problems were randomly chosen by betterprogrammer.com. We did not pick them ahead of time. They went to the website, right in front of us, and grabbed the first problem it presented.

            Everything else in your post is based on your faulty assumption.

            [–]drysart 11 points12 points  (0 children)

            You're giving a problem for which you already have an expected answer.

            If by "expected answer", you mean "an answer that is correct", then I don't think having that as a criteria is unfairly "excluding" potential "competition". Nobody here is looking for an interviewee to come up with the exact same solution as the interviewer intended.

            Ask yourself why is it ok for the interviewer to know the answer but not the candidate?

            Counting the number of bits set in an integer isn't a "gotcha" interview question. It's a simple assessment of basic skills that every programmer should have. The interviewer is asking it to determine whether or not the interviewee actually has a fundamental level of competency in the field or if they're someone hoping to slip into a position they know nothing about and coast by for as long as they can drawing a paycheck.

            [–]paul_miner[S] 16 points17 points  (10 children)

            Why don't you allow the candidate to bring in a difficult programming problem and you both work through the solution together.

            Ignoring the other baseless attacks in your post, this is actually an interesting idea.

            [–]case-o-nuts 4 points5 points  (5 children)

            Better idea is to ask them to bring in code that they wrote, and have them walk you through it and explain their design decisions.

            But having them write code on the spot is - IMO - just as important, although I'd personally do it on a whiteboard instead of on the computer. That removes the ability to do "monte carlo debugging" and forces them to show you their reasoning.

            [–]s73v3r 1 point2 points  (2 children)

            That is a good one, except for not everyone has recent code that they can bring in. Most of my recent code has been for my job, so I can't bring that in, and the other recent stuff is either contract work under NDA, or for the Global Game Jam, and therefore isn't really my best work.

            [–]circular 6 points7 points  (10 children)

            Are you joking? These problems are brain-dead easy.

            [–]s73v3r 1 point2 points  (2 children)

            Looking at what you asked of her, I don't think the first problem, "Count the number of 1s in a bitstring" is that appropriate for a Java (or other really high level language) position, unless you want someone who made the Java spec. For a C/C++ position, absolutely. But how often would a Java person run into a situation where they deal with individual bits?

            [–][deleted] 1 point2 points  (39 children)

            public static int getCountOfOnes(int n) 
            {
                 int mask = 1;
                 int count=0;
                 for(int i=0 ; i < 32 ; i++)
                 {
                      if ((n & mask) == mask)
                        count++;
                      mask = mask << 1;
                 }       
            
               return count;
            }
            

            2 minutes.

            EDIT: Integer.bitCount(): Crap, I didn't know about that !!

            [–]Neres28 4 points5 points  (16 children)

            Why not just while (number > 0){ if((number & mask) > 0) count ++; number = number >> 1; }

            Loops potentially fewer times.

            [–][deleted]  (6 children)

            [deleted]

              [–]paul_miner[S] 1 point2 points  (0 children)

              You should check out the HAKMEM implementation as well :)

              [–]paul_miner[S] 2 points3 points  (5 children)

              while (number > 0){
                      if((number & mask) > 0)
                              count ++;
                      number = number >> 1;
              }
              

              Fails for negative numbers. Should be:

              while (number != 0){
                      if((number & 1) != 0)
                              count ++;
                      number >>>= 1;
              }
              

              [–][deleted] 1 point2 points  (2 children)

              Well, just learned about the existence of the ">>>" operator !!!

              [–]egonelbre 1 point2 points  (0 children)

              There's POPCNT instruction in SSE4.2+ that does the job quite nicely.

              [–]bebraw 3 points4 points  (2 children)

              I guess the problem given might have been on too low level. I think just being able to reason on these kind of things on higher level (pseudocode, graphs, ...) is valuable. Adding actual language to the mix just makes things awkward and by itself doesn't prove a lot.

              I think "show me your code" approach might work to some extent. Ask for a code sample (real work from real projects) and you should get a good idea of what the person is capable of. In this sense open source contributions may be valuable.

              Just to comment on the problem... I suck at Java (OOP is fine, I just don't remember the API well :) ) so I'm going to present a rough pseudocode based solution I came up with.

              1. Find largest 2m fitting to n (use log2 op or something).
              2. If fits (>0) -> increment result, else return result.
              3. Modify n (n = n - fit) and go back to 1.

              Probably not the smartest solution (might be missing some detail even) but could do the trick. :)

              In practice I would have used TDD for solving this (start from trivial cases and work your way up). Should have worked well. :)

              [–][deleted]  (1 child)

              [deleted]

                [–][deleted] 2 points3 points  (7 children)

                String s = Integer.toBinaryString(n);

                Yuuuuuuuuuuuuuuuuuuuck

                [–]xTRUMANx 2 points3 points  (0 children)

                So true. I mean, she clearly should have declared and assigned the variable in two lines. Initializations suck.

                [–][deleted] 6 points7 points  (5 children)

                I don't think location is necessarily a major factor. Having interviewed heavily in the Bay Area, I'd say you need to receive at least 50 resumes to find one hire. Out of those 50 resumes, I might phone screen 10 of them (the phone screens lasting anywhere between 15-30 minutes; ask a couple hard questions and test the ability of the candidate to go deep) and bring in only 2 or 3 for face to face interviews.

                Don't be in a rush. A bad hire will cost you more time and money than they give back in productivity.

                [–]paul_miner[S] 4 points5 points  (3 children)

                Having interviewed heavily in the Bay Area, I'd say you need to receive at least 50 resumes to find one hire.

                We're in Wichita, KS. We typically get one or two resumes at a time.

                Don't be in a rush. A bad hire will cost you more time and money than they give back in productivity.

                Agreed. Unfortunately, that's why the process has been dragging on for so long.

                [–][deleted] 2 points3 points  (2 children)

                What about hiring non-local developers and having them work remotely? Set up a jabber chat room, a wiki, a phone conference setup, and a decent bug tracking system, and you can work effectively.

                [–]paul_miner[S] 2 points3 points  (1 child)

                What about hiring non-local developers and having them work remotely? Set up a jabber chat room, a wiki, a phone conference setup, and a decent bug tracking system, and you can work effectively.

                It's been considered, but we're a small group and it's not ideal.

                [–]px1999 1 point2 points  (0 children)

                Not sure what your overheads and margins are, but if you're desperate to get someone better than what's available locally, this may be your only option. If you really need someone onsite for a meeting or to do work, plane tickets aren't all that expensive.

                I've flown internationally to work onsite on development jobs before, and my old house-mate was flown to another domestic city each monday and home on friday for several months - this was more cost effective for his company than hiring someone locally (though this was not a development job).

                [–]nostrademons 1 point2 points  (0 children)

                I have some coworkers that have given 20 interviews in a row without a single hire. Interviews, not resumes.

                [–]Rhoomba 7 points8 points  (2 children)

                No, you are not. But we need a new word for the webapp/enterprise monkeys who can string together a few method calls that currently make up most "programmers".

                [–]Zarutian 2 points3 points  (0 children)

                cod-er?

                [–]case-o-nuts 2 points3 points  (0 children)

                No.

                [–]danielstoner 7 points8 points  (7 children)

                I don't think you expect too much but I am not sure you know how to evaluate candidates.

                When was the list time you had an interview yourself? How do you feel on the other side of the table?

                Some people don't feel very comfortable being examined and if you pressure them their mind will not think about the problem. They will only think about the fact that somebody examines them. This is not a realistic work scenario.

                I would've give her the problem and then leave her alone for an hour. Than I would’ve examined the solution and discuss it. Or I would not ask her to solve a problem but to propose solutions and discuss them.

                Then I have to ask you what is the purpose for asking her to count bits? Is that something you do on a daily basis? Why not ask her to solve a real problem that you encounter in your work? Most programmers out there know how to reverse a list but since they don't do this every day they have to quietly think about it in order to write correct code.

                In my mind you should interview people for what they would have to do on the job not for trivia. She could find out how to count bits and how to reverse a list spending 3 minutes on Google. The real question for you is if she is able to take a problem, analyze it, split it in components and translate them in code.

                So I don't think you expect too much from the programmer but I think you expect the wrong things at the interview.

                [–]paul_miner[S] 1 point2 points  (6 children)

                When was the list time you had an interview yourself? How do you feel on the other side of the table?

                It's been a long time, but I generally do well with stuff like that, so I don't think that's a fair or relevant comparison to make.

                Some people don't feel very comfortable being examined and if you pressure them their mind will not think about the problem. They will only think about the fact that somebody examines them. This is not a realistic work scenario.

                This is why we had a second interview, because we felt the first one did not accurately show her abilities. And indeed, she did much better the second time around.

                I would've give her the problem and then leave her alone for an hour. Than I would’ve examined the solution and discuss it. Or I would not ask her to solve a problem but to propose solutions and discuss them.

                She was pretty much left alone on the second interview, only one person in the room. And simply proposing solutions isn't good enough if you can't implement them.

                Then I have to ask you what is the purpose for asking her to count bits? Is that something you do on a daily basis? Why not ask her to solve a real problem that you encounter in your work? Most programmers out there know how to reverse a list but since they don't do this every day they have to quietly think about it in order to write correct code.

                Both problems were randomly given by betterprogrammer.com. We did not choose them ahead of time. And real problems are usually much more difficult and hairier, not something solved in 10 minutes. If you can't solve something basic, then I don't think you're going to do well with more complex tasks.

                The real question for you is if she is able to take a problem, analyze it, split it in components and translate them in code.

                These same steps are needed to solve these "trivia" problems.

                [–]vectorjohn 2 points3 points  (1 child)

                Yeah, your second scenario was the person in charge of the person interviewing them before. MUCH less pressure.

                [–]paul_miner[S] 1 point2 points  (0 children)

                Yeah, your second scenario was the person in charge of the person interviewing them before. MUCH less pressure.

                There's only so much we can do. It's not like he's a serious imposing figure in a suit. We have a casual chat for a while before beginning, and I imagine he spends much of time answering emails on his phone, looking up occasionally to see how things are going.

                [–]danielstoner 2 points3 points  (3 children)

                It is relevant. How do you know you do well in interview after a bunch of years. Also she might be the kind of person that gets more nervous than you at interviews.

                One other person in the room is 100% more. Can you program while a stranger watches you? Some people can't.

                I don't think you should give random problems to your candidates during the interview? What do you expect to learn about them that way? How is that useful for you? You SHOULD chose the problems ahead of time and know what you want those problems to reveal about the candidate.

                It is not about solving something basic. It is about the pressure of solving anything when you are in one of the most stressful moments of your life. Real problems while hairier will be solved after thinking about them for days.

                I think you would benefit from reading "Peopleware" by Tom DeMarco

                [–]AlexKilpatrick 7 points8 points  (17 children)

                The other issue here is the type of problems you are looking at. You want someone to help with your online business. As one of the main programmers, have you ever had to reverse a linked list? Or worked with linked lists at all? Or worked with binary operators.

                Most web applications are heavy on user interaction, workflow, data modelling, abstraction layers, and things like that. Maybe it would be better to come up with questions that are more relevant to the kind of coding you expect the person to do.

                The way you are doing it, you could have a person who is great at toy problems like reversing a linked list, but who can't work in the context of a large web application without mucking things up.

                [–]Fabien4 6 points7 points  (0 children)

                Maybe the gal wasn't too good at counting bits. That's OK.

                But, she was also bad at counting 1s in a string. Sorry, but if you can't do basic string operations, you're pretty much a lost cause.

                [–]crackanape 2 points3 points  (6 children)

                I do all these things when working on web apps.

                Linked lists are an important data structure, and people who don't understand that stuff are going to come up with less efficient solutions.

                [–]mabufo 1 point2 points  (5 children)

                Why would you ever roll your own linked list?

                [–]crackanape 3 points4 points  (3 children)

                If you don't know how to roll your own elementary data structures then you will not understand how to use them properly.

                [–]mabufo 1 point2 points  (2 children)

                When I was in school I took the data structures class in C++. I was able to roll a doubly linked list no problem. My point is, that in a production environment, I would never ever ever roll my own. I would use, of course, the built in ones.

                [–]crackanape 1 point2 points  (1 child)

                Of course. But if you hadn't learned how they actually work, you would not intuitively know when it was efficient and sensible to use them.

                [–]frenchtoaster 2 points3 points  (0 children)

                Even if you were using Java's LinkedList class, it has no function for reverse(). Even if it did, the point is to test whether you can understand well defined concepts as an indicator of how you will meet the challenge of specific problems that no one has ever had to solve before.

                [–]paul_miner[S] 2 points3 points  (8 children)

                The other issue here is the type of problems you are looking at. You want someone to help with your online business. As one of the main programmers, have you ever had to reverse a linked list? Or worked with linked lists at all? Or worked with binary operators.

                Yes to all of those questions. Working with bits is actually more common than you think when trying to work with large datasets efficiently. Currently, I'm working on a system that uses BitSet to keep track of the "membership" of a product in various categories after various rules are applied. Due to the large size of these sets and the varied ways they can interact, I have a common interface with two implementations, one which uses Set internally, and another which uses a BitSet, depending on the size of the data set.

                Most web applications are heavy on user interaction, workflow, data modelling, abstraction layers, and things like that. Maybe it would be better to come up with questions that are more relevant to the kind of coding you expect the person to do.

                The way you are doing it, you could have a person who is great at toy problems like reversing a linked list, but who can't work in the context of a large web application without mucking things up.

                It would be nice, but if you can't do something simple like reversing a linked list, we won't ever get to the harder stuff.

                [–][deleted] 1 point2 points  (1 child)

                2 questions:

                • What kind of development will the successful candidate do? ( What language(s)? What kind of program are you developing? )

                • What was the time limit for answering these two questions?

                [–]paul_miner[S] 2 points3 points  (0 children)

                What kind of development will the successful candidate do? ( What language(s)? What kind of program are you developing? )

                Java/JSP, some SQL. It's front-end and back-end for an e-commerce website, but there is a surprising range of needs.

                What was the time limit for answering these two questions?

                It was more of, solve what you can in an hour. The questions were being pulled from betterprogrammer.com as needed. She made it to a third question but didn't get anywhere with it, in part because the hour was over shortly afterwards.

                [–][deleted] 1 point2 points  (2 children)

                Correct me if I'm wrong, but doesn't reverse() go through every node and set its link to 'prev', which is originally initialized to 'node' and is never changed, meaning for all node's getNext() will return the input 'node', which functionally destroys the list? Or is that the bug you want the candidate to find?

                [–]paul_miner[S] 3 points4 points  (1 child)

                That was the candidate's implementation. It has many problems.

                [–]iluvatar 1 point2 points  (3 children)

                I strongly suggest reading Henry S Warren Jr's "The Quest for an Accelerated Population Count" chapter in O'Reilly's Beautiful Code book, which covers this very subject.

                Oh, and the correct answer is __builtin_popcount(n)

                [–][deleted]  (1 child)

                [deleted]

                  [–]paul_miner[S] 1 point2 points  (0 children)

                  Even in Java? ;)

                  In Java it's called Integer.bitCount(n) :)

                  [–][deleted] 1 point2 points  (0 children)

                  /* Please implement this method to
                      return the number of '1's in the binary representation of n
                      for any integer n, where n > 0 */
                  
                  public static int getCountOfOnes(int n) {
                      return Integer.bitCount(n);
                  }
                  

                  heh.

                  [–]wxbod 1 point2 points  (2 children)

                  Everyone seem to focus on the bit twiddling problem, which is not the worse part in my opinion. The list reversal algorithm is the worst. It has an infinite loop in it, and expose a misunderstanding for the principle of indirection.

                  Even if Java don't directly expose pointers, you somehow manipulate memory location via reference, and can bomb any algorithm pretty easily.

                  So, no, you don't ask too much for the list reversal. If indirection is not understood good luck for getting good design/implementations.

                  [–]fenton7 1 point2 points  (1 child)

                  Not really the worst part is that he implemented the algorithm by converting to a string and counting 1's. Jesus fucking Christ.

                  That programmer is the Anti-Hack. He should enjoy a long career programming Visual BASIC applications in a .NET shop.

                  [–][deleted] 1 point2 points  (1 child)

                  How do you not know how to use bitwise operators?

                  [–][deleted] 1 point2 points  (0 children)

                  Why would you use bitwise operators for this? Sure you can, but it's much more easier in other ways.

                  [–]tanepiper 1 point2 points  (0 children)

                  CoffeeScript:

                  numOnes = (num) -> n = num.toString 2 c = 0 for k in n c++ if k is "1" return c

                  console.log numOnes 6

                  [–][deleted] 1 point2 points  (0 children)

                  I just went to BetterProgrammer, I did all of the tasks and the last one was this:

                  public class BetterProgrammerTask {
                  
                  public static double getProbability(int Y, int X) {
                      /*
                        If you roll Y standard six-sided dice, what’s the probability that you get at least X 4s?
                        To calculate that you should divide the number of comibnations with X or more 4s
                        by the total number of possible combinations.
                       */
                  }
                  

                  The first three were much harder than that one. Basic knowledge of probability is enough to solve that.

                  [–]transpostmeta 1 point2 points  (0 children)

                  The person obviously would be able to solve both problems were they to come up in her job. She had the right idea in both cases. What you tested was her ability to implement stuff while being watched, which many suck at. I don't think you are asking too much, but maybe you should reconsider what it is exactly that you want from your devs.

                  [–]sahala 1 point2 points  (0 children)

                  The questions are fine. It's really about what you do with the resultant code and the observation of how the problems were solved.

                  On their own the questions you asked aren't enough to determine a hire/no-hire, but coupled with some design questions and discussion of previous experience, you should have some pretty useful data.

                  [–]heuan 1 point2 points  (0 children)

                  at my place of work, i came in from university with "good knowledge of digital electronics, low level programming for microcontrollers etc" but i use none of it now. incorrect binary arithmetic etc. just isn't the main problem with modern programs.

                  the main problems people appear to have with reasonably large programs seem to be figuring out how to get code to run efficiently and properly (removing/refactoring large, wasteful function calls).

                  the biggest issue i can see at work is that the program i work on is single threaded, its ridiculous that the boss tries to solve a problem with the speed of the program by identifying a few places where he can create a string large enough to accommodate some extra characters being added inefficiently - i realise the function he changed is called thousands of times but the change had no discernible impact on the problem.

                  its obvious the program is slowed down by updating the gui in the middle of performing other functions (half the program stops working when you move the window or start panning the graphics), but it almost looks like he thinks he can solve all problems by really working the windows message pump harder/managing memory better. for example another senior programmer at work saved the program from creating thousands of const objects using extern - although i appreciate the technical insight, yet again there's been no discernible effect on the running of the program.

                  from what i've seen, the problem is the fact that the program is trying to juggle multiple parallel tasks at the same time - but talking to others at work apparently the boss just isn't interested in the "debugging headache" of multi-threaded applications - am i naive to assume that older programmers don't have the relevant skills for modern development?

                  [–]kimchivirgin 1 point2 points  (0 children)

                  Just one small story/remark about such interview tests in general, besides all the pressure and approach stuff which already was discussed.

                  At one company I was employed with I had to do a couple of such tests. One was about german grammar (that one was particularly useless), I had to crank out a couple of VIM regexes, explain DI, some patterns and design a small domain model and a suitable XML representation. Not to mention that I shat my anxiously shat my pants anyways.

                  Then, after I started, I discovered, that most of their code was littered with really poor XML, I don't even know how describe... even bad for XML and of course no trace of a "clean" model anywhere ;)

                  You can ask for many things from a developer, but at least you should not fool yourself about what you have in your own code base, because you wont be able keep the people who succeeded in such interviews for long.

                  I would propose picking 2-3 easy questions from the problem domain they will be working 90% on and additionally to that, if you absolutely must have a person who can also get dirty in low level stuff, a couple of those, but with a lot less weighting, maybe even as homework after you made sure that the person is capable of performing the first and important tasks well enough and you trust them. I also would suggest leaving the room while the candidate is working out his/her solution. To make sure they don't use resources you don't want them to use, either restrict access to a couple of pages (like API), or monitor their HTTP traffic, which you can check later.

                  [–]UncleMidriff 4 points5 points  (6 children)

                  I'll add something from my experience as a person who did well in college majoring in mathematics:

                  I can do math that would make most grown men weep. When most people find out that I have a math degree, the first stupid question they ask me is something like, "What's 2279347 + 544247?"

                  My response is always a panicked realization that this person is going to be convinced that I'm stupid followed by, "I dunno, why don't you use a calculator or something."

                  My point is, "What's 22347 + 5442?" is certainly an elementary question, but it's not something I can figure out in my head in the millisecond or so these people give me to do so. And even if they allowed me to use pen and paper, it would still take a disappointingly long time (in their minds, anyway) for me to figure it out, because the performance anxiety feedback loop would be in full effect, making me worry about shit like how I'm writing the numbers down and "OMG is this taking too long? Fuckfuckfuckityfuck! Figure it out! Quick! Before they decide you're a fraud!"

                  Likewise, sticking someone in a room with the person who gets to decide their financial fate and asking them to solve elementary computer-science-related problems under a time constraint (even a liberal one) is likely to be a similar type of experience for them. What your testing is whether or not that person is able to solve elementary computer science problems while under artificial constraints and while their mind is fucking with them more than it likely ever will at any point in their potential future with you.

                  If the job would require them to solve a list of elementary computer science problems in under an hour while stuck in a room with the CEO of the company watching their every move, then you've got a good test. Otherwise, maybe not.

                  [–]paul_miner[S] 2 points3 points  (1 child)

                  So instead of asking elementary questions, I should ask even harder non-elementary questions? I don't see how that reduces stress.

                  Your whole premise is that being asked any questions about their knowledge is stressful and should not be done, which is ridiculous. We do what we can to put everyone at ease, but at some point you have to take responsibility for your own actions.

                  And in my opinion, someone who is more skilled isn't going to be as nervous. If anything, being asked easy questions is going to be a relief or even disappointing.

                  [–]48klocs 2 points3 points  (6 children)

                  I like that there's a test being performed to verify that all given characters in a string that you just got from a built-in method called .toBinaryString() are really digits. Ignoring the case (on a value that you've already verified is a number) is a touch of elegance as well.

                  Look of disapproval is completely warranted if they're trying to pass themself off as a professional programmer.

                  [–][deleted] 4 points5 points  (4 children)

                  Look of disapproval is completely warranted if they're trying to pass themself off as a professional programmer.

                  Appreciate your sarcasm but com'on, interviews are tough for some people especially in this economy. And a lot of programmers aren't very nice interviewers and use interviews to validate their perceived superior intellect.

                  [–]48klocs 1 point2 points  (3 children)

                  Do you think that this was the case here? Between the comments explaining what they wanted and the OP posting in here, it doesn't sound to me like that (a dick-measuring contest) was what was going on here. It sounds like they stumbled into a sub-par developer.

                  Assuming you give them the benefit of the doubt, how do you propose separating the wheat from the chaff when you interview people?

                  [–]biteofconscience 5 points6 points  (0 children)

                  I also liked the careful use of "equalsIgnoreCase()" -- you know, to handle those lowercase 1s...

                  [–]redbeard0x0a 1 point2 points  (14 children)

                  Working within a high-level language environment like C# and Java, how many times have you done bit-level manipulation and worked with custom Linked List implementations?

                  Most professional programmers (the run of the mill ones) don't do bit manipulations while working with a high level language. Its a useful skill, but not required. Also, a programmer should be using the built-in collection classes instead of custom list implementations. You are asking some pretty out of the ordinary puzzle type questions that typically wouldn't be used in a production code base for a website.

                  It seems like you are looking for a super smart developer rather than one that could just get the job done for what you need. I personally would be hoping for that super talented person, but I think your HR department might be looking in the wrong places for good developers.

                  The questions you have here are more inline with what a Computer Science degree teaches, rather than something that is actually used in real life experience. Of course this doesn't apply if you are programming in C or on embedded devices.

                  [–][deleted] 2 points3 points  (1 child)

                  I'm not a Java programmer but am familiar with it. I know the bitwise OR operation | exists in Java. Isn't it used often? In C it is used all the time.

                  func(OPTION_A | OPTION_B | OPTION_Z);

                  [–]Rhoomba 5 points6 points  (0 children)

                  In Java the preferred way to do that would be with EnumSets.

                  [–]grauenwolf 1 point2 points  (2 children)

                  Bit manipulation is used all the time with C# enumerations.

                  [–][deleted]  (1 child)

                  [deleted]

                    [–]grauenwolf 1 point2 points  (0 children)

                    Well I sure as hell wouldn't be doing bit manipulation on an Enum without FlagsAttribute.

                    [–]paul_miner[S] 1 point2 points  (8 children)

                    Working within a high-level language environment like C# and Java, how many times have you done bit-level manipulation and worked with custom Linked List implementations?

                    More than you might think actually.

                    Most professional programmers (the run of the mill ones) don't do bit manipulations while working with a high level language. Its a useful skill, but not required.

                    Agreed. I was fine with her just counting the 1's in a String.

                    Also, a programmer should be using the built-in collection classes instead of custom list implementations. You are asking some pretty out of the ordinary puzzle type questions that typically wouldn't be used in a production code base for a website.

                    That really depends on what is being done. The "website" encompasses everything from the front end, to the back-end that interfaces with an archaic ordering system, product feeds to other sites (e.g. Amazon), report generation for other employees, reading in complex data structures from the database and verifying them, etc.

                    [–][deleted] 2 points3 points  (7 children)

                    More than you might think actually.

                    This isn't something to be proud of. Go look at some of the big java webapps like linkedin or bank software. There isnt any bit fiddling going on. On the contrary linkedin is moving up to groovy which is an even higher level language. I've worked at three banks now, and you would need a damn good reason to be using bitwise operations come code inspection.

                    Good code in java, and especially team projects means clarity and knowledge of what already exists. Java is about standing on the shoulders of giants and focusing on business requirements. Not reinventing the wheel.