The process took 1 day. I interviewed at Amazon (Seattle, WA) in Jan 2012
Interview
Which of C++, Java languages supports Multiple Inheritance and which does not ? Follow up: What do you think of Java not supporting Multiple Inheritance?
C++ supports multiple inheritance of classes, Java (and C#) supports single inheritence of classes and multiple inheritance of interfaces.
When C++ added multiple-class inheritence pure OOP was thought to be "the" solution to everything.
In the meantime it was proven that class inheritance is good, but it ends up with tightly coupled systems. The more class inheritance you use, the more likely that one small change will have a huge impact on your entire system.
Loosely coupled inheritance - interfaces - are considered a much better option these days.
Interview questions [2]
Question 1
11 Answers
Given references to roots of two binary trees, how do you short circuit determine whether the sequences of the leaf elements of both the trees are same ? The structure of two BTs may be different. Short circuit : for ex. If the very first leaf element of each tree is different, the algorithm should stop immediately returning false instead of checking all the leaf elements of both trees.