It can be demotivating, but don't give up, and take a look at some of your algorithm books. Or cut to the chase:
http://www.amazon.com/Cracking-Coding-Interview-Programming-...
http://www.amazon.com/Cracking-Coding-Interview-Programming-...
http://www.amazon.com/Cracking-Coding-Interview-Programming-...
Gayle also has a number of YouTube videos such as:
and a web site:
Others include:
Elements of Programming Interviews: The Insider's Guide by Adnan Aziz
http://www.amazon.com/Elements-Programming-Interviews-Inside...
Programming Interviews Exposed: Secrets to Landing Your Next Job by John Mongan, Noah Kinder, and Eric Giguire
http://www.amazon.com/Programming-Interviews-Exposed-Secrets...
If you want to take that approach, and say "f%!# it, I'm going to buckle down and work my ass off so I do get the job next time" there are a few concrete steps you can take.
1. Find, read, and do the exercises in two or three of the various popular books on "programming interviews". I'm thinking of books like Cracking the Coding Interview[1], Programming Interviews Exposed[2], Ace the Programming Interview[3], etc.
2. The companies you mentioned are well known for asking lots of detailed questions on fundamental computer sciences concepts. If doing "big o" analysis and talking about algorithms in detail isn't your forte, get a couple of good Algorithms course books and go through them. Personally, I'm a fan of the Robert Sedgwick books[4][5][6][7], and the CLR[8] book is a standard in this area.
3. Look over the many various articles / blogs / etc. written about preparing for Google interviews.
https://www.google.com/search?q=google+interview+preparation
I have never applied to Google myself, so I can't speak to that from first-hand experience, but this Steve Yegge blog post always struck me as being excellent:
http://steve-yegge.blogspot.com/2008/03/get-that-job-at-goog...
4. Take as many interesting Coursera, EdX, Udemy, etc. courses as you can find time for.
5. Write code any chance you can. Get involved in, or start, an open source project (or two). Volunteer to code for a non-profit / charity or something in your area. Write an app for yourself, to fill a need of your own.
6. Make sure you broaden your horizons and challenge yourself. If you've always written, say, Java or C++ or Ruby code, then make an effort to learn Go, or Erlang or Haskell or Prolog.
All of that said, as I've gotten older, I probably feel a little bit less of the "I'll show you!" thing. I've developed more of a stoic approach, and almost a bit of a zen mindset. There's a lot to be said for a sort of calm, peaceful acceptance of things, even when they are negative. There's a lot more one could say about this, but I don't want to get too philosophical here. I'll just point out that you applied to two... TWO.... companies. Out of like a BILLION possible companies you could work for. Ok, maybe not a billion, but certainly millions, or thousands, depending on where you live and your willingness / ability to travel.
My point is, don't put too much weight on what happened with Google or Amazon. The whole "dream companies" thing is a crock of shit, IMO, looking back on it with hindsight. I've worked for two companies in my career that I once thought of as my "dream" destinations, and neither experience was anything special (neither was bad either), and not worth getting all worked up over.
Final last bits of advice.
1. Read Nietzsche
2. Read Ayn Rand
3. Get drunk
4. Listen to some Queensryche
5. Profit???
[1]: http://www.amazon.com/Cracking-Coding-Interview-Programming-...
[2]: http://www.amazon.com/Programming-Interviews-Exposed-Secrets...
[3]: http://www.amazon.com/Ace-Programming-Interview-Questions-An...
[4]: http://www.amazon.com/Algorithms-Java-Parts-1-4-Pts-1-4/dp/0...
[5]: http://www.amazon.com/Algorithms-Java-Part-Graph-Edition/dp/...
[6]: http://www.amazon.com/Algorithms-Parts-1-4-Fundamentals-Stru...
[7]: http://www.amazon.com/Algorithms-Part-Graph-Edition-Pt-5/dp/...
[8]: http://www.amazon.com/Introduction-Algorithms-Edition-Thomas...
Easy for me to say, since I find problems like those easy; I cranked through a few dozen of them with only having to really think about a couple.
If you can't answer them all yet...well, now you have something specific to study.
[1] http://www.amazon.com/Cracking-Coding-Interview-Programming-...
In their best form, these types of questions are a litmus test for whether you have a certain type of background. When they fail it's because they test for skills not required by the job. It's fashionable to complain about this, but it seems to me to be more practical and useful to just get better at answering these sorts of questions. Leveling up from "terrible" to "adequate" at this will take less time than you think, and due to the craigslist penis effect[1] will put you way ahead of the game.
Easy resource to get started: https://www.interviewcake.com/
This book is pretty well regarded: http://www.amazon.com/Cracking-Coding-Interview-Programming-...
Btw, anyone with better starting places for this, please jump in.
[1] http://www.iwillteachyoutoberich.com/blog/the-craigslist-pen...
EDIT: formatting
i've actually been working on learning angular for the past few weeks. i've stopped updating my github in that time since i'm just doing basic stuff, but once i finish some more tutorials and documentation i plan on building an angular project to display on my github. are there any particular features that would really catch your eye as someone who hires programmers?
any suggestions regarding the coding interview problem? i see http://www.amazon.com/Cracking-Coding-Interview-Programming-... recommended a lot.
You can see the proof for yourself when you burn through the following two books within the three months. a) http://www.amazon.com/Elements-Programming-Interviews-Inside... b) http://www.amazon.com/Cracking-Coding-Interview-Programming-...
You need to spend 4hrs+ on weekends though. You will get to talk to candidates already working in the top companies and will be working in a group of 20+ highly motivated and intelligent peers.
2.) Work through one of the popular coding interview books [1][2].
3.) Practice off-keyboard things like white-boarding and public speaking. Get up in front of your white board and work through a problem like you're teaching a class on the subject.
I recognize that 1 and 2 might feel like gaming the system a bit - they are, but as long as companies continue to practice contrived interviews targeted preparation will naturally follow.
As stated, you don't lack the ability to perform in general, just within the artificial confines of an interview.
Casually mentioning that your day is full of interviews should help you appear more desirable..
http://www.grokit.ca/spc/computer_science_review/
So, perhaps this can get you started.
I plan on getting a copy of: http://www.amazon.com/Cracking-Coding-Interview-Programming-... too.
I strongly recommend - Algorithms in a nutshell from O'Reilly (http://www.amazon.com/Algorithms-Nutshell-In-OReilly/dp/0596...)
and - Cracking the Coding interview (http://www.amazon.com/Cracking-Coding-Interview-Programming-...)
Those two books are perfectly concise and straight to the point to understand and learn exactly what you feel you are lacking as a self-taught programmer.
The first one will teach you what you have to know, putting everything into work context, making it really easy to understand why and how this or that algorithm is useful.
Cracking the coding interview then offers really good challenges to practice and master those algorithms. And of course, if you are interested in getting a job, will perfectly prepare you for that ;)
Prior to my first technical interview I spent tons of time studying algorithms and data structures. Looking back I feel that my time would have been better spent selecting several sample questions (such as the ones you included) and solving them on a whiteboard over and over again (and checking and improving them along the way).
For questions check out careercup.com, glassdoor.com, project euler, and the Cracking the Coding Interview book: http://www.amazon.com/Cracking-Coding-Interview-Programming-...
The more practice you have, the faster you will be able to: recognize what type of problem a particular question is, come to an initial solution, and improve upon that solution.
Feel free to reach out to me with any questions! (contact info in my profile)
Why the rejetions? Has any company told you what exactly were the reasons for rejection? Ask for a reply from the interviewers and the specific questions. Don't get those questions wrong again.
I contribute to a plethora of open source projects in a range of languages such as
C++, Perl, Python, and even various Lisp-like languages.
How about a link to the contributions? Perhaps you can get some better feedback from people looking at those. Well my bookshelf is stocked...
...
I enjoy mathematics. ...
...
And for all of this I still blunder my way through...
...
I still draw a blank when asked what the magnitude of complexity is for the guests
function I just wrote.
Why the blundering? It's not a memorization exercise, it's an exercise in counting and math: My input is N, and I loop from 0 to N, hence complexity is O(N).
I loop twice, so complexity is O(2N).
The input is M and N, my function has nested loops, 0 to M, 0 to N,
complexity is O(M * N).
My input is N and I divide and conquer recursively cutting in half...
that's (N/2)/2)/2)/2... lg N!
I think most good interviewers will be ecstatic if you can reason your algorithm out loud, even if you're a little off. It's the reasoning and thinking that matters more.I'd also recommend studying for interviews seriously. Cracking the code interview, http://www.amazon.com/Cracking-Coding-Interview-Programming-..., it helps quite a bit.
[1] http://www.amazon.com/Cracking-Coding-Interview-Programming-...
http://www.amazon.com/Cracking-Coding-Interview-Programming-...
Edit: It looks like the author of the above has a newer book out called "The Google Resume", probably worth taking a look at too.
MIT's IAP course resources are pretty good too: http://courses.csail.mit.edu/iap/interview/materials.php
http://www.amazon.com/Cracking-Coding-Interview-Programming-...
On the bright side, something of an industry has been built up around preparing people for tech company interviews (similar to the SAT prep industry). Check out Gayle McDowell's Cracking the Coding Interview[0], CodeKata[1], or Interview Cake[2].
[0] https://www.amazon.com/Cracking-Coding-Interview-Programming...
[1] http://codekata.com/
[2] https://www.interviewcake.com/