Other common practice is to have a coding question during your phone interview or sent over email that you need to code and send back within an hour. So here are several examples of coding questions I received and needed to solve right away:
1. Write a function that would: return the 5-th element from the end in a single linked list of integers, in one pass, and then provide a set of test cases against that function.
(Hint: Try to solve this problem for n-th element and afterwards invoke it for 5-th one)
2. Implement queue using two stacks. Originally the problem was using data structure stack and you need to come with the conclusion that you need 2 of them:)
3.You have a very large linked list that is circular(the last node is pointing to the first one) and you have pointer to the first element. Insert an element after the last one. (Think optimisation).
Try to solve these problems fast - an hour per problem, writing the code in visual studio or other siutable enviroment:) Take care:)
Tuesday, April 1, 2008
Thursday, March 13, 2008
Expedia questions
I'm making this blog just to remember all the questions that I had during different interviews.
I'm like a collector - I'll post not only my questions but also my friends ones and I believe that if you just sit down and solve some of the problems that I published here you'll be prepared for a software interview.
Questions from Expedia:
On the phone - describe how are you going to design a system that serves 2 elevators (elevator algorithm). Basically you have 2 elevators in an 18 floor building and you need some program that manages them - how will this program look like, describe in details all the classes and objects that you are going to use or implement. Smart question - capture all your OOP skills + the way you are thinking.
The real interview:
First guy asked me to implement a routine that has 2 parameters - string base and string needle and returns the index of the last appearance of the needle in the base:
Int32 LastIndexOf(String base, String needle)
And because we had some time he asked me to solve the riddle about 2 dice and presenting the days of a month with them - basically you have 2 six side dice and you need to put on every side just one number (numbers are 0-9) in such an order that you can represent every day of a month - 01, 02...31. It has a trick in it that I couldn't think of at the time:) But he was happy with my prove that is not possible:) Don't be mislead - it's possible it's just require some unusual glimpse at the problem.
The second one presented me with a binary unordered tree and asked me to find the closest number to a given one in that tree.
Afterwards he asked what if it wasn't a tree but an array or list - how can I change my routine - he basically force me to implement everything with collection and Iterator/Enumerator.
The third one was a sql guy and he asked me to write a store procedure. You have a self reference table - EmployerId, Name, ManagerId where the managerId is pointing to the employerId and he wanted the store procedure to print the name of the employer and the name of the manager.
He asked me about transactions, what is primary key, foreign key in the database, how they are implemented, what is the 3 normal form, is it always useful and why not, etc - all database stuff.
The fourth one asked me to print all the substring of a given string (combinatorial question). For example if you have the string "abc" you need to print "", "a", "b', "c", "ab", "ac", "bc", "abc". I ended up writing an iteratively solution.
The fifth one was a web developer and basically draw me a web site on the board and asked me to write the html and java script for it. It was funny - to write html on the white board:) So basically the web page has 2 edit boxes - hours and minutes where you can input numbers between 1 and 12 and a button . When you click the button next to it he wanted to see a number. This number represents the angle between the hands in the clock that you just inputted:)
He wanted to see how I'll do the javascript and if I can write the html from scratch.
The end.
I'm like a collector - I'll post not only my questions but also my friends ones and I believe that if you just sit down and solve some of the problems that I published here you'll be prepared for a software interview.
Questions from Expedia:
On the phone - describe how are you going to design a system that serves 2 elevators (elevator algorithm). Basically you have 2 elevators in an 18 floor building and you need some program that manages them - how will this program look like, describe in details all the classes and objects that you are going to use or implement. Smart question - capture all your OOP skills + the way you are thinking.
The real interview:
First guy asked me to implement a routine that has 2 parameters - string base and string needle and returns the index of the last appearance of the needle in the base:
Int32 LastIndexOf(String base, String needle)
And because we had some time he asked me to solve the riddle about 2 dice and presenting the days of a month with them - basically you have 2 six side dice and you need to put on every side just one number (numbers are 0-9) in such an order that you can represent every day of a month - 01, 02...31. It has a trick in it that I couldn't think of at the time:) But he was happy with my prove that is not possible:) Don't be mislead - it's possible it's just require some unusual glimpse at the problem.
The second one presented me with a binary unordered tree and asked me to find the closest number to a given one in that tree.
Afterwards he asked what if it wasn't a tree but an array or list - how can I change my routine - he basically force me to implement everything with collection and Iterator/Enumerator.
The third one was a sql guy and he asked me to write a store procedure. You have a self reference table - EmployerId, Name, ManagerId where the managerId is pointing to the employerId and he wanted the store procedure to print the name of the employer and the name of the manager.
He asked me about transactions, what is primary key, foreign key in the database, how they are implemented, what is the 3 normal form, is it always useful and why not, etc - all database stuff.
The fourth one asked me to print all the substring of a given string (combinatorial question). For example if you have the string "abc" you need to print "", "a", "b', "c", "ab", "ac", "bc", "abc". I ended up writing an iteratively solution.
The fifth one was a web developer and basically draw me a web site on the board and asked me to write the html and java script for it. It was funny - to write html on the white board:) So basically the web page has 2 edit boxes - hours and minutes where you can input numbers between 1 and 12 and a button . When you click the button next to it he wanted to see a number. This number represents the angle between the hands in the clock that you just inputted:)
He wanted to see how I'll do the javascript and if I can write the html from scratch.
The end.
Subscribe to:
Comments (Atom)