Software Engineer / Developer Interview Questions
- 1of 1 vote
AnswersGiven an input like:
[2, 4]
[1, 2]
[3, 6]
[1, 3]
[2, 5]
Use it to reconstruct this binary tree:1 2 3 4 5 6
Edit: The "1" is the root, I dont know why is aligning to the left
- eduardo.renshaw January 25, 2014 in United States for Seattle HQ
Note that:
a) The first number in each line is a parent.
b) Second number is a child.
c) The left child always shows up in the input before the right child.
Return root.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou as a developer are tasked to create an application that builds invoices that are send out to the company’s clients. Invoices are sent to the client’s address and the client should pay the invoice amount by a given date otherwise fees could incur. The client should be able to see detailed information about the items they are being billed for, like item cost, tax, quantity, etc. The client can be billed for products and/or services. Services are not taxable and product tax varies by client zip code.
- eduardo.renshaw January 25, 2014 in United States
Using the objected oriented language of your choice; design an object model for this application.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 1of 1 vote
AnswersWrite a method to print output of a^b
- careerCupguy10 January 25, 2014 in United States| Report Duplicate | Flag | PURGE
PayPal Software Engineer / Developer Algorithm - 0of 0 votes
AnswersDesign an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine.
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 25, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a method to decide if two strings are anagrams or not.
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 25, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a method to replace all spaces in a string with '%20'.
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 25, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 25, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 0of 0 votes
AnswersAssume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring (i.e., “waterbottle” is a rotation of “erbottlewat”).
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 25, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 0of 4 votes
AnswersGiven a kernal code in "0"th machine. How soon you can replicate the kernal across N machines. Now if the machines has upload and download bandwidth constraints, how can you impove the copy time.
- Guy January 24, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Operating System - -1of 3 votes
AnswersGiven a log file from a website which contains the user ID and the accessed URL, find the TOP "sequence" of 3 urls amongst ALL visitors of the website. The sequence of urls have to be in sequence as they are accessed.
- Guy January 24, 2014 in United States
My solution is Two hashtables and one MaxUrl object. One hashtable<String,String> userName as key and url sequence as value, where url sequence is three url contatenated by a special character like '#' (google#amazon#yahoo). This value is in FIFO manner. For each value, we check with the second hashtable and see if they exist before, if yes, increment the count, if no, insert the new sequence with count set to 0. So second hashtable<String, Integer> url sequence as key and count as value. Keep a curr_Max to store the current max count, when exceeded, updates max_urlSequence.
Any suggestion?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures - 0of 2 votes
AnswersHow to design a zoo in oop? Some basic ideas are to have an abstract Animal class and have birds, mammal extend from it. Also have a class called Cages with different size. Zoo will contain a list of animal, list of cages, probably some workers. What else should I add and how could we improve the design? Thanks.
- Guy January 23, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 1of 1 vote
AnswersYou have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of T1.
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 23, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 0of 0 votes
AnswersLet G=(V,E) be a connected, undirected graph. write a program to compute paths in G that traverses each edge in E exactly once in each direction.
- Anonymous January 23, 2014 in United States
Example: If there is a Graph with edges in a triangle form V1, V2,V3 we need to display all the paths from V1-V2-V3-V1 , V1-V3-V2-V1
Note: Graph can have any number of nodes and there is no source or destination node given as input.| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer - 0of 0 votes
AnswersGiven a binary search tree, design an algorithm which creates a linked list of all the nodes at each depth (i.e., if you have a tree with depth D, you’ll have D linked lists).
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 23, 2014| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 4of 4 votes
AnswersGiven an unordered array of positive integers, create an algorithm that makes sure no group of integers of size bigger than M have the same integers.
- Fred_Castro January 22, 2014 in United States
Input: 2,1,1,1,3,4,4,4,5 M = 2
Output: 2,1,1,3,1,4,4,5,4| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 1of 3 votes
AnswersHow would you synchronize a linked list across multiple computers. If nodes are added/removed to a linked list on one computer, all others must reflect this change. Concurrancy must be accounted for. (java)
- Guy January 22, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - -4of 6 votes
AnswersBag-of-words model. Write the process of search based on inverted index. The follow up is given some attributes(an array), how to filter the search result.
- Guy January 22, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersFind all the repeating sub-string sequence of specified length in a large string sequence. The sequences returned i.e. the output must be sorted alphabetically.
- techpanja January 21, 2014 in United States
For e.g.
Input String: "ABCACBABC"
repeated sub-string length: 3
Output: ABC
Input String: "ABCABCA"
repeated sub-string length: 2
Output: AB, BC, CA| Report Duplicate | Flag | PURGE
Linkedin Software Engineer / Developer - 0of 2 votes
AnswersGiven a set of intervals, how to find the interval with maximum number of overlaps (not the length of the overlap).
- Guy January 21, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a directed graph, design an algorithm to find out whether there is a route be-
- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> January 21, 2014 in United States for Oracle
tween two nodes.
What is the complexity of the algorithm?| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 1of 3 votes
AnswersFind the shortest path in a maze (from origin to destination). I believe we are supposed to use Dijkstra or BFS. But what I am confused with is that Dijkstra computes the shortest path based on the distance of each edge. But a maze doesn't have weighted edges, and its shortest path should be 'minimum number of cells'. How can we make use of Dijkstra, or BFS?
- Guy January 21, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 2 votes
AnswersGiven a tree (Not a binary tree) and two nodes A and B, node has parent and child properties find the path P from A to B (In a tree there is only one path). Reduce the complexity to O(P).
- Anon January 20, 2014 in United States for Yahoo Sports| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 1of 1 vote
AnswersDetermine whether an interger is a multiple of 5 in O(logn) time complexity. You cannot use / and %.
- xuwithsurprise January 20, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 2 votes
AnswersThe final question was just how to write a connection pool (i.e, a class that returns connections to the user, and if the user is done, returns them back to the pool)
- Guy January 19, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Data Structures - -1of 1 vote
AnswersDifference between cloning a directed graph vs undirected graph. There are lots of tutorials on how to clone a directed graph online, such as leetcode. But what if it's undirected graph? It appears to me that it would be pretty much the same? For example,
public class Node() { public int data; public ArrayList<Node> adjacent; }
For example, A can have a neighbor called B. Therefore, we may traverse from A to B. For undirected graph, does it imply that B can always traverse back to A? Even if it does, if we use a hashtable to keep track of which node has been copied and processed in the queue, then the logic for cloning a directed graph should be the same as for a undirected graph, right?
- Guy January 19, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 2 votes
AnswersFind the LCA (least common ancesstor) of k nodes of a given binary tree. Later extend this for n ary tree.
- Nascent January 19, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 3 votes
AnswersDoes a given file name match a single-star pattern? (can't use regex I assume)
- Guy January 18, 2014 in United States
index.html matches *.html
foo.txt does not match *.html
matches(“index.html”, “*html”) returns true
matches(“foo.txt”, “*html”) returns false
matches(“cat”, “c*t”) returns true| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm