How to Pass a Programming Interview
If you have an unbounded abundance of good candidates, it is a different story then when you are a new startup fighting for talent.<p>At highly targeted companies such as Google, Facebook et al, I&#x27;m sure that if they have a dryspell of good candidates in a given month (can&#x27;t think of a reason why), then they revert to things like: &quot;We don&#x27;t care if you don&#x27;t get the &#x27;trick&#x27; immediately, we&#x27;ll give you hints&quot; and &quot;we just want to see how you think and how you code&quot; and &quot;just talk through the problem&quot; and &quot;you should not learn specific problems and if you see one you know just tel your interviewer&quot; or &quot;cracking the code interview type of questions are banned&quot;.<p>But the reality is that people who apply to Google (or Apple or Amazon or Facebook or Microsoft...), are very smart, and want to work there very much, so while they can probably do well without preparation, due to the fact they will have competition with all this year&#x27;s new Stanford &#x2F; MIT &#x2F; CMU graduates on a limited amount of positions, they take no chances. I have a friend who has a masters degree from a target school and it took him 4 attempts to get into Google. 
He is smart, he probably did well in the interviews, but you are being compared to others, so until he went and worked on those pretty useless skills of: practicing writing fast on a whiteboard, getting interview books and practicing tricky problems, doing a lot of online judge problems, he didn&#x27;t get in. Why? because if you have two candidates, both smart, one has practiced whiteboard coding for all of the problem sets on geeksforgeeks &#x2F; careercup &#x2F; glassdoor, and one haven&#x27;t, then even if both are presented with a new problem, most chances it might be a variant of one of those other &quot;usual suspects&quot;. e.g. after I solved the famous water trapping problem (tough one if you don&#x27;t get hints), the idea for the largest water container problem just pops to mind, and if you know that you can find the only non duplicate number in a list in O(1), then the problem of finding if an unsorted list of numbers is an arithmetic series with just O(1) memory is practically the same trick.<p>So think of two developers, both are awesome, both know CS and both are fast coders.<p>One practiced whiteboard coding and knows the XOR trick for duplicate numbers, his code for such a question will be written in 1 minute<p><pre><code>    public int findDupe(int[] nums){
        int dup = 0;
        for (int num : nums){
            dup ^= num;
        }
        return dup;
    }
</code></pre>
The other guy, who didn&#x27;t see these kinds of problems will probably use a hashmap and x2 more lines for the same problem.<p>Both are O(N) time an O(1) complexity, but the hashmap guy might accidentally say it&#x27;s O(N) memory (common mistake for frequency maps)<p>Bottom line, both are good candidates, and the only reason the first one thought of the XOR solution in 1 minute without a hint is that they either saw it before (it&#x27;s not that rare) or a real genius (statistically less likely, but still possible)<p>If you don&#x27;t have enough good candidates, you might have the time and energy to really see which one of these will perform better at work using work related questions other than tricks like this.<p>But if you have unlimited good candidates coming in, the one that will solve it in 2 minutes will be the one that will stand out from the crowd, there is simply no other good way to filter out so many people. I&#x27;m sure they have tons of false negatives. (and probably also a few false positives, but I doubt it&#x27;s too many)<p>So the system is broken, but also SATs and GREs are broken. Popular schools, popular jobs, will have to put filtering systems that are not only directly related to the ability to do the job. Someone at Google is simply writing CRUD apps for a living all day, I&#x27;m sure. But I&#x27;m sure his interview tested him on a much harder set of problems.