Applied Online...
Phone Interview.. Not difficult.
Question 1: Why make data members private and access them using getter and setter methods when you can access them directly by making them public.
Question 2 : Given stock prices of n days. Find when to buy and when to sell stock in order to gain maximum profit
Question 3 : Given an array of size greater than 'x' and a range 0 to x . Find duplicate elements in the array. Hint. You can destroy the array but the solution should use O(1) space and O(n) time where n is the size of the array.
On Site Interview:
Interview 1 :
Interview with 2 software developers
Started with some questions related to my projects
Q1 : Diamond Inheritance Problem in C++. Use of virtual keyword. And how are things handled internally. Basically checked my understanding of vtable
Q2 : Can you use virtual keyword with destructors?
Q3 : Given heads of two linked lists. Find if the two linked lists intersect.
Solution should not use extra memory.
Q4 : Reverse linked list. Tested concepts of double pointers, pass by value and pass by reference.
Interview 2 :
Interview with 2 software developers
Q1 : In what case would you use BST over a hash table..
Q2 : Insertion in BST
Q3 : Find 'k'th smallest element in BST. What extra information would you require here
Q4: Given a string which has a lot of spaces beween words . Remove these extra spaces in the string
eg: " I love New York " --> "I love New York"
Q4 : You get an input in the form [2 lowercase characters , A number] .. eg [aa,10] , [bd, 12]..
Given a two letter input, find the last 10 numbers associated with the string..
Design a data structure to implement this without using STL. Basically I was asked to design a hash function.
Interview 3 :
Interview was with a project manager
Q1 : Find the first distinct element in an array
Q2 : C++ does not have byte datatype. How would you create this datatype.
Q3 : Lets say I have a code currently executing on my machine. I overwrite the code with a newer version. But the older version is still executing. Why do you think this is happening.
Interview 4 :
Interview with HR
General HR Interview