Software Engineer / Developer Interview Questions
- 1of 1 vote
AnswersFind the deepest node in a binary tree:
- 4661 July 11, 2014 in United States
Example:
A
/ \
B C
/ \ / \
D E F G
\
H
Return Node ‘H’| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer - 1of 1 vote
AnswersWrite a function to remove the duplicated characters from a string, and maintain the order of the characters.
- 4661 July 11, 2014 in United States
ex. “abracadabra” ? “abrcd”| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
Answerswhat is the difference between internal repository and internet repository?
- Muni July 09, 2014 in India| Report Duplicate | Flag | PURGE
Infosys Software Engineer / Developer Java - 0of 0 votes
Answerswhat about your project performance...how can i answer this question?
- Muni July 08, 2014 in India| Report Duplicate | Flag | PURGE
Infosys Software Engineer / Developer Java - 0of 0 votes
AnswersHow to convert http to https in java....can anyone knows please tell me?
- Muni July 08, 2014 in India| Report Duplicate | Flag | PURGE
Infosys Software Engineer / Developer Java - 0of 0 votes
AnswersFind the consecutive number of 1s in a unsigned integer?
- leela July 04, 2014 in India
eg suppose you are given 67 the binary equivalent for this is 0b1000011
so here 1 is consecutively appeared 2 time maximum
so 2 is the answer| Report Duplicate | Flag | PURGE
UST global Software Engineer / Developer C - 5of 5 votes
AnswersLet's say you have 10,000 servers, each with a billion integers. How do you find the median?
- 352905 July 03, 2014 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a string that contains exactly a single pair of parenthesis, return parenthesis and their contents, so "xyz(abc)123" yields "(abc)". etc.
- Anirudh July 03, 2014 in India
Conditions:
1)No variable allowed
2)Collections not allowed
3)Regex, String.indexOf() not allowed.| Report Duplicate | Flag | PURGE
Ibibo Software Engineer / Developer - 0of 0 votes
AnswersGiven a string that contains exactly a single pair of parenthesis, return parenthesis and their contents, so "xyz(abc)123" yields "(abc)". etc.
- Anirudh July 03, 2014 in India
Condition: You are not allowed to use a variable anywhere, Regex is not allowed.| Report Duplicate | Flag | PURGE
Ibibo Software Engineer / Developer Java - 0of 0 votes
AnswersGiven a string that contains exactly a single pair of parenthesis, return parenthesis and their contents, so "xyz(abc)123" yields "(abc)". etc.
- Anirudh July 03, 2014 in India
Condition: You are not allowed to use a variable anywhere.| Report Duplicate | Flag | PURGE
Ibibo Software Engineer / Developer Java - 1of 1 vote
AnswersYou have 5 data sources. There is a program which calls these data sources and returns a count value.
You need to speedup this program. How do you do that?
This is a sample code
- dmrrb1980 July 01, 2014 in United Statesint count = getCount(ds1); if(count < 100 ) count = count + getCount(ds2); if(count < 100) count = count + getCount(ds3); if(count < 100) count = count + getCount(ds4); if(count < 100) count = count + getCount(ds5);
| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Threads - 4of 4 votes
AnswersImplement a method called printNonComments() which prints out a extract of text with comments removed.
- Ash June 30, 2014 in UK
For example, the input:
hello /* this is a
multi line comment */ all
Should produce:
hello
all
You have access to a method called getNextLine() which returns the next line in the input string.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 1of 1 vote
AnswersA new Kindle feature is being developed to rank customers based on their reading speed.
- camiloa136 June 26, 2014 in Vancouver
A customer's "reading speed" is the maximum number of pages they have read in a single minute over the previous 10 minutes. Every minute, we will log the customer's current page, which can be used to calculate this speed. For example:
Current Time: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15]
Current Page: [0, 5, 6, 8,12,15,17,21,24,27,29,31,37,42,49,52]
Current Speed: [0, 5, 1, 2, 4, 3, 2, 4, 3, 3, 2, 2, 6, 5, 7, 3]
"Reading Speed": [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 6, 7, 7]
We want to produce separate leaderboards for each book. Each customer will only read one book at a time, but multiple customers may read the same book.
Every minute, the "updateReadingSpeeds" method will be called to report each customer's reading progress. Please implement this method:
void updateReadingSpeeds(String customerID, String bookID, int pageNumber)
At any time, we should be able to request the full leaderboard for any book. Please implement the "printLeaderboard" method:
void printLeaderboard(String bookID)
The output should be CSV printed to standard output, like:
Customer ID,Reading Speed,Rank
Customer 1,5,1
Customer 3,4,2
Customer 2,4,3
Customer 5,2,4
*The updateReadingSpeeds method will be called every minute for every customer.
*CustomerID will uniquely identify a customer, bookID will uniquely identify a book
*Page numbers are integers between 0 and 1000000, and will never decrease over time.
*Customers who "tie" with the same reading speed can be ranked in any order.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 3 votes
AnswersGiven
{ //"Restaurant Types"."[categoryNames]" "American" : "[Burger, French fries, Potato Chips]", "Italian":"[Pizza,Bread Sticks, Potato Chips]" }
Assume this kind of data is given as input and loaded into your choice of Data Structure.
- careercupuser June 25, 2014 in United States for Back-End Developer
Using Category name return the no of resturarnt type. Ex: if i/p is Potato Chips, O/P should be : 2 (American and Italian).
Please mention your Data structure and logic.| Report Duplicate | Flag | PURGE
Yelp Software Engineer / Developer Algorithm - 0of 0 votes
AnswerI recently had an generous offer that I turned that based mainly on my answer to this question in PHP.
- ekittell June 24, 2014 in United States
Write an algorithm to generate all possible combinations of a product code based on all available product options. Each option has a code/slug that make up the product code. For example shoes:
style: 001, 002, 003, etc...
color: red, blue, white, etc...
size: 7,8,9,10,etc...
gender: m,f
etc: etc...| Report Duplicate | Flag | PURGE
Software Engineer / Developer - 0of 0 votes
AnswersI recently had a generous job offer based mainly on my answer to this question in PHP.
- ekittell June 24, 2014 in United States
Write an algorithm to generate all possible combinations of a product code based on all available product options. Each possible option value has a code/slug that make up the product code. For example, shoes:
style: 001, 002, 003, etc...
color: red, blue, white, etc...
size: 7,8,9,10,etc...
gender: m,f
etc: etc... number of options and possible values for each option have to be flexible, though pretty finite
first combination: shoes001red7m
I used a few loops inside loops, 4 I believe, I don't remember now.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - -4of 4 votes
AnswersSwap 2 nodes in a Binary tree.(May or Maynot be a BST)
- l33t June 21, 2014 in United States for ChromeCast
Swap the nodes NOT just their values.
(preferably in Java please..(My requirement not theirs :p))
ex:
5
/ \
3 7
/ \ /
2 4 6
swap 7 and 3
5
/ \
7 3
/ / \
6 2 4| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
AnswersMake a function that shows the common elements in two arrays. Part 2: With duplicates (small explanation). Part3: without duplicates
Answer:
- mikeldi10 June 19, 2014 in United States for Amazon Instant Videoint[] intersect(int[] array1, int[] array2){ if(array1.lentgh == 0 || array2.length == 0) return {}; Set<Integer> set = new HashSet<Integer>(); for(int i = 0; i < array1.length ; i++){ set.put(array1[i]); } List<Integer> list = new ArrayList<Integer>(); for(int i = 0;i < array2.length ; i++){ if(set.contains(array2[i])){ //map.put(map.get(array2[i])-1); //short explanation of how to do it with dupplicates set.remove(array2[i]); list.add(array2[i]); } } return list.toArray(); }
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 2of 4 votes
AnswersHaving a table Genre with two colums (Id, Genre) make an SQL Query that finds the Ids with the genre Action and Comedy. (those will have multiple lines for each Id)
Answer:
- mikeldi10 June 19, 2014 in UK for Amazon Instant Videoselect g.id from (select id from genre where genre = 'Action') x, genre as g where g.id = x.id and genre = 'Commedy'
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer SQL - 0of 0 votes
AnswersHow would you do to sort different files. All the data does not fit in memory.
- mikeldi10 June 19, 2014 in UK for Amazon Instant Video
Answered: Merge sort like method, where you sort each file. For the end merge, read some data from each file (make sure you have at least one from each file) and sort them| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersIn Mathematics each number has one special number, which it supports, chosen as follows. It counts the number of ones in its own binary representation, and adds this count to itself to obtain the value of the number it supports. That is, if j(m) means the number of ones in the binary representation of m, then m supports m+j(m). For example, the number eight (1000 in binary) supports nine, whereas nine supports eleven.
- anonymous June 16, 2014 in India
However, in this way not all the numbers get supported; some are left without support, and we call these numbers bleak. For example since one supports two, two supports three and three supports five, there is no number less than four, which would support four, so four is bleak.
Your task is for a given number recognize if it is bleak or supported by some number.| Report Duplicate | Flag | PURGE
Sap Labs Software Engineer / Developer Coding - 0of 0 votes
AnswersSuppose you have a telephone directory. There You have telephone number and names. Names can be duplicate but telephone number will be unique, No use some datastructure in such a way that when we give telephone number it will return the corrosponding name, Again when we give a name, it will retrieve all the entries with same name and their corresponding telephone number from the datastructure. Complexity should be minimum as much as possible. I gave a solution of O(n) for the second case, but they did'nt agree this to be optimised.
- Ghosh June 15, 2014 in India| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSuppose you have a million integer numbers.
- l33t June 14, 2014 in United States for Hangouts
Return all possible values of a,b and c such that
a+b+c<=d.
d will be provided to you.
ex: if the numbers are 1,2,3,4,5,6,7
and d=7
[1,2,3]
[1,2,4]
[1,2,3] will be same as [1,3,2] and [3,2,1]...
follow up:
Return all such parts that satisfy the above condition if d is not provided.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersHow and where to initialize const data member in C++, if you did not initialize it in member initializes list?
- aap.shweta June 11, 2014 in India| Report Duplicate | Flag | PURGE
Software Engineer / Developer C++ - 1of 1 vote
AnswersGiven a string with multiple spaces write a function to in-place trim all spaces leaving a single space between words
- employee11 June 09, 2014 in Israel
e.g.
_ _ _ Hello _ _ _ World _ _ _
Hello _ World _ _ _ _ _ _ _ _ _| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
Answerhow to put my program on remote server so that it will run automatically when i initiate it .
- istiyak916 June 09, 2014 in India| Report Duplicate | Flag | PURGE
Software Engineer / Developer - -2of 2 votes
AnswersThe boggle game - given a 2d array of characters
- FauxPas June 07, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm Coding Java - 1of 1 vote
AnswersEvaluate a given mathematical expression, taking into consideration the BODMAS rule. The expression contains no brackets.
- FauxPas June 07, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm Coding Java - 0of 0 votes
AnswersThe Boggle game.
- FauxPas June 07, 2014 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSerialize and deserialize a tree.
- FauxPas June 07, 2014 in United States
Given a tree - not necessarily a binary tree - the serialize method should create a string for the tree. The deserialize method should be able to reproduce the same tree using the string derived from the serialize method.
Basically, serialize() takes in a tree and returns a string, deserialize() takes in a string and returns the tree.| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm Coding Java Object Oriented Design