Coding Interview Questions
- 0of 0 votes
AnswersImplement atoi()
- XXXX July 22, 2008| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a function to make a pointer point to a different object.
- XXXX July 22, 2008| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C Coding - 0of 0 votes
AnswersRemove spaces from a string (in-place)
- lax July 22, 2008| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Coding Algorithm - 0of 0 votes
AnswersDetect loop in a singly linked-list
- Hank Lee July 22, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding Algorithm - 1of 1 vote
AnswersImplement atoi(char *p)
- Hank Lee July 22, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding - 0of 0 votes
AnswersReverse linked-list
- Hank Lee July 22, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswerWhat is in IP header?
- Hank Lee July 15, 2008| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer Coding - 0of 0 votes
AnswersCode a function 'dedupe' that removes duplicate characters from a string.
- Facebook July 15, 2008| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven an integer array, design an algorithm to find the three indexes whose sum is equal to a given sum k.
- jack July 13, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 5of 5 votes
AnswersHad my first and second phone interview with Amazon. I was dropped. This site has been a great help towards my preparation and most questions are based on what you find here.
- S July 01, 2008
Posting my Questions is a small way of saying Thanks!
Interview 1:
1. What is polymorphism.
2. Design an OO parking lot. What classes and functions will it have. It should say, full, empty and also be able to find spot for Valet parking. The lot has 3 different types of parking: regular, handicapped and compact.
3. Coding: I have an integer array where every number appears even number of times and only one appears odd times. Find the number.
(I said hashtable and he asked me to write code with Hashtable)
4. What data structure would you use to look up phone numbers for customer names.
(I said Hashtable. Asked why hashtable, why not a tree. I said HT has O(1). Asked is order always 1, when more than O(1) in HT.
Second Interview:
1. Starter: Describe your college projects.
2. OO Design: Design a deck of cards. What classes, data structures will you use? How will you shuffle the cards? How will you divide (deck) among players. What class/function do you need to denote players and where will you add them? What class/function do you need to deck? What if I need to add 2 jokers to the deck of 52 cards.
3. Data Structures: How will you use a hashtable to find data in a tree. (Then he rephrased) suppose I have a hashtable, I want to store the data in a tree instead of a bucket. How will I do it. What complexity to find an element.
4. Bits & Bytes: Find if a binary representation of a number is palindrome. The function should work irrespective of number of bytes for an integer. Suppose if our machine is 4 bytes for an int, how will you use the program for 8 byte machine.
5. Unix: Suppose I have 100's of html files in many directories. I want to find the files having phone numbers.
b) Suppose I have 2 files having phone numbers, find the repeating phone numbers. (I said sort and grep). Then he asked what if the lines cannot be sorted.
All the best guys. I think the second interview was challenging since the interviewer was prodding until he heard a leave me alone. So it means that though they are based on questions in cc, be prepared for extensions. I think this site is all you need to prepare for Amazon interview.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java Data Structures Object Oriented Design Coding - 1of 0 votes
AnswersI had first round of phone interview today. She asked me to write two very simple codes in C++ and dictate her as I write. She was also writing the code as I was coding. The questions were:
- Aniruddha Gore June 26, 2008
1. Write code to find nth node (from front) in a linked list.
2. Write code to find minimum node in a BST.
Then test cases for both of these questions. Then the same question which need use of "uniq" command of UNIX.| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Coding Linked Lists - -2of 0 votes
AnswersI am trying to write a program to find the longest word made of other
- anonymous May 24, 2008
words. For instance, If my file has the following words (sorted):
test
tester
testertest
testing
testingtester
The longest word should be testingtester. I am trying to use "Trie"
for this. But, I guess there might be some problem in using this. Can
you suggest me any other better solution for this?
Thanks in advance| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Coding - 0of 0 votes
Answers- When to use Refernece/Pointer
- Ozzy May 23, 2008
- What is Copy ctor? Passing by ref to const
- Mutable? Why use it?
- Design a web browser class.
- Why use Exceptions? What are some of the concerns with exceptions?
- What is a dynamic cast? And when do we use it?
- What is a design patter? Name a few design patterns.
- What happens when you take the address of a reference?
- Few behavioral questions.
This was a phone screening. Will report more with the onsite questions.| Report Duplicate | Flag | PURGE
London Investment Bank Software Engineer / Developer C Coding Algorithm - 0of 0 votes
AnswersTelephonic Interview 3)
- The Hercules May 17, 2008
1) Generate 1st ten prime numbers.
[ Note - Interviewer needed a simple but smart approach instead of high-fi prime number generation algorithms. The "simple" approach should not be brute force]
2) Given 2N + 1 number out of which 2N numbers are duplicate find the unique number.
3) Given a sequence of number Generate cross product of all numbers such that the product at any index does not use the number at the same index.
Example
arr = {a1, a2, a3, a4, a5 };
product[] = {a2*a3*a4*a5, // a1 not used
a1*a3*a4*a5, // a2 not used
a1*a2*a4*a5, // a3 not used
a1*a2*a3*a5, // a4 not used
a1*a2*a3*a4 // a5 not used
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersTelephonic interview 1)
- The Hercules May 17, 2008
1) 2) Given a log file with user information select one Random winner from the users. You can use constant memory
2) Given 2 arrays of integers find the common elements of both arrays.
[Discussed different approach using Hashmap, Binary Search Trees, Sorting etc]
3) Discussed different approach to find unique element from a set of 2N numbers where only 1 number is unique
[Discussed different approach XOR, Sorting etc. Asked me to write sorting based approach & send him]| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C Coding Algorithm - 0of 0 votes
AnswersOnsite interview 1)
- The Hercules May 17, 2008
1) Represent a Tic Tac Toe game class.
2) Now write a function IsWinner which takes a player as input and returns whether the player has won or not.
3) Now write a funtion Play which plays the game| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C Coding - 0of 0 votes
AnswersWrite code to reverse a singly linked list
- chriswho May 15, 2008| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Software Engineer / Developer Data Structures Coding Algorithm - 0of 0 votes
AnswersImplement a function which returns the 2 largest numbers in an array.
- Hank Lee May 10, 2008| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer Coding - 3of 0 votes
AnswersFunction which lists all the possible dates for given year.
- Ripul Patel May 09, 2008| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Coding - 0of 0 votes
AnswerWrite a function to find intersection of two arrays.
- moovgoar May 08, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersSuppose you have N books. Each book may have soft copy, hard copy, CD, DVD format.
- The Hercules May 05, 2008
Design the data structure to hold the N books & its different formats in memory. This data structure should support the functionality that [any] 1 format of the book, will be displayed as its primary format in GUI & the remaining formats should be displayed as secondary format.
If the popularity of some format for a particular book is more than other formats how will organize/choose the data structure.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 1of 0 votes
AnswersBackground:
- gauravk.18 May 04, 2008
For any perimeter of a rectangle, there may be multiple different dimensions that result in that specific
perimeter. When there are multiple dimensions for the same perimeter, there may also be multiple areas. In other words, any one perimeter can result in different areas depending on the possible combinations of dimensions that can make that perimeter.
Definition:
A dimension or instance of dimensions for a rectangle is a pair of length and width values. A dimension with length 5 and width 4 is considered the same as a dimension with length 4 and width 5. The area of a rectangle is the length multiplied by the width. The perimeter of a rectangle is equal to the sum of the lengths of all 4 sides or the sum of 2 multiplied by the width and 2 multiplied by the length.
Requirement:
A finite set of possible perimeters of a rectangle exist given a maximum perimeter, minimum length of any side, and the constraint that all sides are whole numbers; we will call this set U. Find the subset of perimeters in set U where all of the possible dimensions for a perimeter in the subset have areas common with the areas of one or more other perimeters in set U. Your program should take the minimum length of any side and the maximum perimeter, respectively, as command line arguments and output a comma separated list of the perimeters that meet the criteria explained above, sorted from lowest to highest. The program should be submitted in a single Java class with an implemented main function that provides the correct output given the two input arguments.
Example:
javac YourClass.java
java YourClass 1 64
10,14,18,20,22,26,30,34
Please make sure your program can be run with the exact syntax above. You can name the class anything you like, but the class name will be passed to a program that will compile it and then run a set of tests on the resulting program. It is important that your class will compile and run from within a local directory, not a package directory.| Report Duplicate | Flag | PURGE
Hi5 Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswerWrite code to reverse a linked list.
- newguy April 29, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding - 2of 0 votes
AnswersWrite an aligned malloc & free function. Which takes number of bytes and aligned byte (which is always power of 2)
- NewGuy April 26, 2008
Ex. align_malloc (1000,128);
it will return memory address multiple of 128 of the size 1000.
aligned_free();
it will free memory allocated by align_malloc.| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Computer Architecture & Low Level Coding - 0of 0 votes
AnswersWrite an printhex function which implements "%x" in printf without using printf.
- NewGuy April 26, 2008
Example :-
printhex(10) output is A .| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding