It's not a serious post... but I have interviewed with Amazon and their questions are a big part of why I don't work there. (The other reason is that when I asked people what they were working on, they all said they were rewriting all the Perl code in Java "because Amazon is a Java company" - apparently that was the biggest business need at the time)
Rather than go into great detail on why I don't like their questions, I'm going to pick out one that stands out as an example. It starts:
"Suppose I want to <description of some user story>, so I want you to design a system that <vague description of an implementation method>."
Okay, I'm thinking, done this before a lot of times, it's bland but not an unreasonable way to find out how somebody approaches problems. But they haven't finished talking, and they add one more sentence:
"Make sure you show me the objects and classes that your system will use."
This is the point when I try not to let my disappointment and irritation show. It's not just that they've completely prejudiced the question, by forcing it down one particular design path, it's that they've made it clear this is not a test of my ability to design systems, it's a test of my ability to mimic their design of the system. Worse yet, in one stroke this destroys any hope of finding out how the candidate thinks; instead, it just measures how well they can think along certain lines.
I don't have a problem with object-oriented designs - I'd probably have done things that way anyway. But I do have a problem with companies that hire based on conformity to groupthink. I don't want to work with a group of people who were selected based on their performance at this kind of question.
There's a lot more to software engineering at amazon than just rewriting perl code into java. There's also rewriting C++ code in java. And there's rewriting java code in java to accommodate for some service your code was dependent on being deprecated. Really, there's all kinds of fun.
"The other reason is that when I asked people what they were working on, they all said they were rewriting all the Perl code in Java "because Amazon is a Java company" - apparently that was the biggest business need at the time"
Having sat in on these kinds of discussions before at companies large and small, while it is certainly sometimes true that companies make a ridiculous platform decision like, "We're a java company", more often than not the decision is a lot more complicated. They might have felt that it was easier to hire people who knew Java, or they leveraged off the shelf software that was written in java, or they acquired a company with interesting tech based on java, or a million other reasons.
That doesn't mean they made the right decision, but I'm just making the point that what may trickle down as "we're a java company" didn't start out that way, and may not be based in that fundamental stupidity.
I conducted interviews at Amazon. Sadly, most of the time that question was about measuring the ability of the candidate to do object-oriented design at all. Usually we didn't care what the final data model looked like, so long as it was logical (and much more often than not, it wasn't) - and we gave candidates every opportunity to explain and justify the classes they designed. But you are correct in that Amazon loves OO, and functional or other approaches wouldn't have been looked at favorably.
FYI Google's codebase is also heavily Java. I'm not sure if it's a good idea to judge companies/projects based on the language they use. [Edit: Okay, maybe I misunderstood that part]
Did the other interviewers also ask similar questions?
c'mon, if you are as smart as you believe yourself to be, do you actually believe that the reason they ported their Perl code to Java was because "Amazon is a Java company"?
I could see many reasons to port one of the worlds largest sites off of Perl and onto something like Java, one being the availability of developers that are proficient in Java vs Perl.
Also, if the company you work at uses OOP to design their systems it's perfectly normal to ask you to design something with regards to those restrictions.
I personally don't think this post is a serious compilation of question that get asked at Amazon considering the stature of the company nevertheless i think an interview at amazon will never be complete without rigorous test of candidates problem solving skills and/or the specific capabilities that he is applying for. Also the kind of questions that are mentioned in the article are the kind of questions HR's ask to confuse the candidate and the sole purpose of these questions is to check the candidates presence of mind and how he tackles those questions.IMHO Amazon is a great company to work at there is no doubt in that.
I just interviewed and got a job offer with Amazon as a college hire. The entire interview was literally a single long-ish (a few hours) coding project in the language of your choice. No HR nonsense, no questions about my weaknesses or challenges I have faced. It was quite refreshing from other interviews. I wrote code, wrote tests, wrote documentation, got a job, no bullshit.
I worked for Amazon, and looked over the list of allowed/prohibited interview questions on the internal wiki. I did not see any of these question. Furthermore, they are against asking puzzle-type and behavioral questions.
Hmm, when I interviewed for an internship at Amazon, they asked me a behavioural question or two. Might have been that I had no previous experience and they needed to gauge how I worked with people somehow. Or that wiki isn't strictly followed by interviewers?
I interviewed for Lab 126 (like everyone else on the internet). I was really excited about the prospect but the guy giving the interview had an attitude problem and was completely uninterested in the process.
He insisted on grilling me on a metaphor in my personal statement as if it were literally true. I honestly don't know if he was trying to piss me off, or was (slightly) autistic and didn't understand metaphors. Once I'd gotten him off that, I mentioned I had a friend who worked at Lab 126, which he was also completely uninterested in. When your interviewer isn't interested in the fact that someone you worked with for 5 years works down the hallway from him? You're not getting that job. It was pretty clear a decision had been made against me before the interview ever took place and Amazon was just wasting my time.
if all the numbers from 1 to 250, but one, were written in random order (no spaces) how would you find the missing number?
FOR EXAMPLE, 132456789101113 is 1-13 and not very random. most answers below have misunderstood me (well, less now that some have been deleted in shame... ;o)
you can get the digits, just by seeing what is missing. but then you seem to be left with a rather tricky partition problem. so i guess dynamic programming? is there a better way?
would it help to pick out unique combinations (if the pattern 249 occurs just once, it must be 249, unless it is the missing number)? how far would that get you?
i guess since you know the missing digits you should check for each permutation - you might get lucky and not find one.
is there some cute trick? something involving suffix trees?
[edit: anonymoushn has a good point - it's not guaranteed unique]
# arr must contain all of the numbers from 1 to k except one
# returns the number which is missing
def missing_number(arr):
return ((len(arr)+2) * (len(arr)+1))/2 - sum(arr)
I can't really talk about the article, since it is down :(
Edit to reflect edit in the parent: The problem as posed is not soluble in general. For k=21,
Add all the numbers in the list up, and then subtract that value from the sum of 1 to 250. That value is the missing number, in O(n) time and O(1) space. This only works if all the numbers are only written once though.
I'm sure there are faster ways but a quick and dirty approach would be to count how many of each digit are in the input string, then compare to the expected result, which is easy to figure out. This will tell you what digits are missing from the input. There will be at most 3 of them, then just search the input for the possible valid combinations of those digits, as soon as you find one that is missing, you're done.
Add them all up, subtract that from the actual sum of 1-250 and voila. Optimization bonus: you don't need to do the second sum, there's a closed form (I don't remember what it is, but I do remember Gauss came up with it as a kid).
So I see a number of replies that say 'add the list up' but there is no list. There are no spaces, you would have to add in the spaces yourself which is an extremely difficult problem.
Since there are no spaces in the list:
1) I would count the instances of didgits 0-9
2) compare those counts to the counts produced by the complete set of didgets
3) The ones that fell below in count are the didgits in the missing number
4) Count the instances of the permutations of your missing didgets
5) compare those counts to the counts from the full list
6) Done.
My quick take on it is that you have to generate a list of all the 1-tuples, 2-tuples and 3-tuples in that very long string, along with the start and end indexes of each tuple.
Then you find a set of tuples which cover 1-250 (missing one number) and which don't overlap.
You can start by filtering out all the 3-tuples which are over 250.
I might use a hash table to put together a list of all duplicates. Any hash table entry with no duplicates has to be right. Use the indexes that have been removed from the "eligible" pool to remove tuples from the hash table. Iterate.
Of course it's entirely possible that iterating like that could still leave you without a solution. At which point a guess has to be made and to continue solving. If said guess is bad, backtrack and make a different guess.
Obviously it's harder to implement than to outline. And I've probably missed a bunch of optimization.
"Gee, that's an ugly way to store numbers. Where did this data set come from? What business process generated it, and under what constraints? Can I talk to the guys who own that process?"
Once you know the actual sum, you can do it either:
sum all, subtract total - sum.
Or with data structures:
it would be a variant of the "given an array find all pairs of numbers that add up to a sum". The benefit of using the data structure approach would be that you can now find x missing numbers in the range 1 - 250.
note* the closed form might have a off by one error
I would think you could start with assuming that all numbers are used, so you know how many of each digit you should see. Calculating how many of each digit you actually saw should give you a list of which digits were not seen. Then, you should have a much smaller search for the permutations of the missing digits. (This make sense?)
I'm ridiculously curious to know if there is a clever trick to this! :)
Create an array of 250 booleans. Go through the list 3 times. First all the 1 digit numbers, then the 2 and 3 digit numbers. Set the array entry for the resulting numbers to true. The entry that is false is the missing number.
Interviews are a horrible test of how someone will perform on the job. Never in work life are you required to come up with a solution immediately. Those types of solutions are almost always wrong. It's only after deep thought and 100s of hours toiling on a problem from every angle that an elegant solution that simplifies presents itself. But sadly, the only way to know if someone is capable of that is to actually hire them for a trial week or 30 days and see how they do and immediately fire or sign for a longer term contract.
[+] [-] asuffield|12 years ago|reply
Rather than go into great detail on why I don't like their questions, I'm going to pick out one that stands out as an example. It starts:
"Suppose I want to <description of some user story>, so I want you to design a system that <vague description of an implementation method>."
Okay, I'm thinking, done this before a lot of times, it's bland but not an unreasonable way to find out how somebody approaches problems. But they haven't finished talking, and they add one more sentence:
"Make sure you show me the objects and classes that your system will use."
This is the point when I try not to let my disappointment and irritation show. It's not just that they've completely prejudiced the question, by forcing it down one particular design path, it's that they've made it clear this is not a test of my ability to design systems, it's a test of my ability to mimic their design of the system. Worse yet, in one stroke this destroys any hope of finding out how the candidate thinks; instead, it just measures how well they can think along certain lines.
I don't have a problem with object-oriented designs - I'd probably have done things that way anyway. But I do have a problem with companies that hire based on conformity to groupthink. I don't want to work with a group of people who were selected based on their performance at this kind of question.
[+] [-] InclinedPlane|12 years ago|reply
[+] [-] mattzito|12 years ago|reply
"The other reason is that when I asked people what they were working on, they all said they were rewriting all the Perl code in Java "because Amazon is a Java company" - apparently that was the biggest business need at the time"
Having sat in on these kinds of discussions before at companies large and small, while it is certainly sometimes true that companies make a ridiculous platform decision like, "We're a java company", more often than not the decision is a lot more complicated. They might have felt that it was easier to hire people who knew Java, or they leveraged off the shelf software that was written in java, or they acquired a company with interesting tech based on java, or a million other reasons.
That doesn't mean they made the right decision, but I'm just making the point that what may trickle down as "we're a java company" didn't start out that way, and may not be based in that fundamental stupidity.
[+] [-] icodestuff|12 years ago|reply
[+] [-] brahma1337|12 years ago|reply
Did the other interviewers also ask similar questions?
[+] [-] CholbiJack|12 years ago|reply
I could see many reasons to port one of the worlds largest sites off of Perl and onto something like Java, one being the availability of developers that are proficient in Java vs Perl.
Also, if the company you work at uses OOP to design their systems it's perfectly normal to ask you to design something with regards to those restrictions.
[+] [-] TIJ|12 years ago|reply
[+] [-] andrewcooke|12 years ago|reply
[+] [-] next89|12 years ago|reply
[0] http://www.businessinsider.com/companies-ranked-by-turnover-...
[+] [-] gamegoblin|12 years ago|reply
[+] [-] sumzup|12 years ago|reply
[+] [-] brahma1337|12 years ago|reply
It seems superficial and cynical, and doesn't seem to have anything useful to say. (Also, the post is tagged as 'Industry News'...??)
[+] [-] webo|12 years ago|reply
I worked for Amazon, and looked over the list of allowed/prohibited interview questions on the internal wiki. I did not see any of these question. Furthermore, they are against asking puzzle-type and behavioral questions.
[+] [-] todazar|12 years ago|reply
[+] [-] od2m|12 years ago|reply
He insisted on grilling me on a metaphor in my personal statement as if it were literally true. I honestly don't know if he was trying to piss me off, or was (slightly) autistic and didn't understand metaphors. Once I'd gotten him off that, I mentioned I had a friend who worked at Lab 126, which he was also completely uninterested in. When your interviewer isn't interested in the fact that someone you worked with for 5 years works down the hallway from him? You're not getting that job. It was pretty clear a decision had been made against me before the interview ever took place and Amazon was just wasting my time.
Left a bad taste in my mouth.
[+] [-] andrewcooke|12 years ago|reply
FOR EXAMPLE, 132456789101113 is 1-13 and not very random. most answers below have misunderstood me (well, less now that some have been deleted in shame... ;o)
you can get the digits, just by seeing what is missing. but then you seem to be left with a rather tricky partition problem. so i guess dynamic programming? is there a better way?
would it help to pick out unique combinations (if the pattern 249 occurs just once, it must be 249, unless it is the missing number)? how far would that get you?
i guess since you know the missing digits you should check for each permutation - you might get lucky and not find one.
is there some cute trick? something involving suffix trees?
[edit: anonymoushn has a good point - it's not guaranteed unique]
[+] [-] anonymoushn|12 years ago|reply
Edit to reflect edit in the parent: The problem as posed is not soluble in general. For k=21,
You can discover the missing digits in linear time, but determining from there whether the input has a unique solution seems a bit annoying.If a valid permutation of the missing digits is missing, you win, but you can have a unique solution without that being the case:
[+] [-] oh_sigh|12 years ago|reply
[+] [-] mbell|12 years ago|reply
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] untitledwiz|12 years ago|reply
[+] [-] hyperion2010|12 years ago|reply
Since there are no spaces in the list: 1) I would count the instances of didgits 0-9 2) compare those counts to the counts produced by the complete set of didgets 3) The ones that fell below in count are the didgits in the missing number 4) Count the instances of the permutations of your missing didgets 5) compare those counts to the counts from the full list 6) Done.
[+] [-] msandford|12 years ago|reply
Then you find a set of tuples which cover 1-250 (missing one number) and which don't overlap.
You can start by filtering out all the 3-tuples which are over 250.
I might use a hash table to put together a list of all duplicates. Any hash table entry with no duplicates has to be right. Use the indexes that have been removed from the "eligible" pool to remove tuples from the hash table. Iterate.
Of course it's entirely possible that iterating like that could still leave you without a solution. At which point a guess has to be made and to continue solving. If said guess is bad, backtrack and make a different guess.
Obviously it's harder to implement than to outline. And I've probably missed a bunch of optimization.
[+] [-] CamperBob2|12 years ago|reply
[+] [-] XenithShade|12 years ago|reply
Once you know the actual sum, you can do it either: sum all, subtract total - sum. Or with data structures: it would be a variant of the "given an array find all pairs of numbers that add up to a sum". The benefit of using the data structure approach would be that you can now find x missing numbers in the range 1 - 250.
note* the closed form might have a off by one error
[+] [-] taeric|12 years ago|reply
I'm ridiculously curious to know if there is a clever trick to this! :)
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] woofyman|12 years ago|reply
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] seanMeverett|12 years ago|reply