Illusion
BAN USER- 0of 0 votes
AnswersNo coding, just was asked to tell how I would do this:
- Illusion in United States
Adding a new part to the webpage that shows recently viewed items.
Questions: What items would you put in the web page?
How would you design the data structure?
How many items should be put on the list?
What would be size in bytes if we store 10 items per user?
Discuss other issues.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersImplement a cache that stores a fixed amount of data, provides random access to the elements and is circular (like after completely filling a cache array, overwrite policy is overwriting the first item, then the second item and so on)
- Illusion in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven: A tree in which each node has a pointer to its parent and two nodes.
- Illusion in United States
Print path for each of the two nodes from node to root.
If path for one node is partially same for the second node then only print the part of the path that is not same.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a million points (x, y), give a O(n) solution to find 100 points closest to (0, 0).
- Illusion in United States| Report Duplicate | Flag | PURGE
Amazon Algorithm
- 1 Answer If you have an offer that you ...
If you have an offer that you have accepted, and you tell Microsoft that, they will ask you for contact details of the HR of the company whose offer you signed to contact them and ask them if its ok for Microsoft to interview you, if you dont give them details they will cancel your interview.
- Illusion September 12, 2013
Microsoft has this policy where they dont consider you as a candidate if you have signed an offer already (and they know this, you can just as easily hide it) and will ask you to re apply after 8 months.
Please be careful of what details you reveal. My personal experience, I went on site and just to come back without being interviewed because I told them I have signed an offer and the only reason why I am attending the interview is because Microsoft is the better option.| Flag | PURGE
This is the algorithm that I gave him:
1) Go through all the points once to calculate distance of each of the points from (0, 0).
2) Copy first 100 points in an array.
3) Sort the array
3) Starting point number 101, compare it to the last element of the array.
If the point is smaller, swap the points.
Swap the new last point in the array with points that come before it until the array is sorted again.
Repeat step 3 until end.
while(Stream.hasNextChar())
{
char current_char = stream.readChar();
if(array[character - '0'] == 0)
{
array[character - '0'] = 1;
Linked_Hash_Set.put(current_char);
}
elseif(array[character - '0'] == 1)
{
array[character - '0'] = 2;
Linked_Hash_Set.remove(character);
}
}
return the first element of the Linked_Hash_Set
Since the number of character is constant, ASCII - 128, Extended ASCII - 256 and Unicode - 65535, storage space required for linked hash map and the array is constant.
/************************************
node1 - first node
node2 - second node
Designed for BT not BST
************************************/
node Reachability(node subroot, node node1, node root)
{
node current_node = node1;
while(current_node != root)
{
if(current_node == subroot)
return current_node;
else
current_node = current_node.parent;
}
if(current_node == subroot)
return current_node;
else
return null;
}
node LCA(node root, node node1, node node2)
{
node LCA = Reachability(node1, node2, root);
while(LCA == null && node1 != root)
{
node1 = node1.parent;
LCA = Reachability(node1, node2, subroot);
}
return LCA;
}
node LCAMain(node root, node node1, node node2)
{
node LCA1 = LCA(root, node1, node2);
node LCA2 = LCA(root, node2, node1);
node finalLCA = Reachability(LCA1, LCA2, root);
if(finalLCA != null)
return finalLCA;
return(finalLCA = Reachability(LCA2, LCA1, root));
}
One of my friends was asked this question;
The interviewer wanted a O(n2) solution with no extra space.
Algorithm that he told me that I think works goes something like this:
for each character in the array
{
start checking from the end of the array towards the start to see if there is a substring present while keepinf track of the largest substring found so far.
}
Your name makes that comment ten times better hahahaha
- Illusion July 22, 2015