Lively
BAN USER- 0of 0 votes
AnswersImplement a web crawler. Follow up - parrarelize it.
- Lively in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Algorithm - 0of 0 votes
AnswersGiven points on the Cartesian plane. Return the K points closest to the origin (0,0).
- Lively in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Algorithm - 0of 0 votes
AnswersImplement a Reader/Writers lock by only using primitive locking semantics (such as mutex,semaphore, etc..)
- Lively in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Coding - 0of 0 votes
AnswersYou are given a "hand" in the game of blackjack. where cards are numbered 1 - 10, A = 1/11 J - 12,Q - 13, K - 14. a Hand consists of several cards. Given a single hand, you need to return the score of that hand which is closest to 21.
- Lively in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer - 0of 0 votes
AnswersGiven an N X M matrix where some position are free and some have trees in them. You can build a house on any group of free positions that form a square (including a single position). Return the largest house you can build given these requirements.
- Lively in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Algorithm - 0of 0 votes
AnswersThis is a two part question related to Markov string generation.
- Lively in United States
Part 1: Read a training set of strings. For each character in any of the strings, calculate the probability of seeing that character and store it for later use. (this part is about coming up with the right data structure and correct probability calculation).
Part 2: Based on the training set from Part 1, generate a random string of length N.| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersGiven an API ReadFromDisk() which returns a block of 256 bytes from disk. Implement the API Read(SizeInBytes) which reads SizeInBytes bytes from the disk by calling only ReadFromDisk. Notice that every call to ReadFromDisk() will read the next 256 bytes from disk.
- Lively in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersGiven an API ReadFromDisk() which returns a block of 256 bytes from disk. Implement the API ReadEx(SizeInBytes) which reads SizeInBytes bytes from the disk by calling only ReadFromDisk. Notice that every call to ReadFromDisk() will read the next 256 bytes from disk.
- Lively in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
Answersx = x++ + ++y;
- Lively in United States
y = ++x + ++y;
what are the values of x,y after these are executed ?| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer C - 0of 0 votes
Answersreverse the words in a sentence: "hello world" -> "world hello"
- Lively in United States| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer C - 0of 0 votes
Answersimplement sqrt(x)
- Lively in United States| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Math & Computation
I would use a combination of a doubly linked list, a hash table and a min heap.
The hash table maps from a property to its location in the linked list. The linked list holds the items in order, and when an item is viewed it is moved to the end of the list. The list also points for each item to its location in a min heap of size 100 (not all properties are in the heap). I would have a routine that would periodically remove items from the list based on the time (and update the rest of the data structures). When a property is viewed, it is added/updated in the hash table. It is put at the end of the linked list with its new time. Then we compare the number of views for that item with the top of the min heap. if it is larger, we pop the top of the min heap and insert the new item to the heap.
void GetInOrderSucc(BNode *Root)
{
BNode *Curr = Root;
BNode *RNext;
while(Curr)
{
RNext = Curr->Right;
if(!RNext)
{
Curr = Curr->Left;
continue;
}
while(!(RNext->Left) && RNext->Left != Curr)
RNext = RNext->Left;
if(!(RNext->Left))
{
RNext->Left = Curr;
Curr = Curr->Right;
}
else
{
RNext->Left = NULL;
Curr->Next = RNext;
Curr = Curr->Left;
}
}//while
}
No I'm not!
where do you see a recreation of the entire list ?
I do the reverse on the list itself (using double pointer). and the comparison on the list itself. I do use recursion which implicitly means that I'm using a stack but there is nothing wrong with using recursion. The entire operation is happening on the same list (no additional lists).
void Reverse(Node **List)
{
Node *First = *List;
Node *Prev = NULL;
Node *Next = NULL;
while(First)
{
Next = First->Next;
First->Next = Prev;
Prev = First;
First = Next;
}
*List = Prev;
}
bool IsPalindrome(Node *List)
{
if(!List || !List->Next)
return (true);
else
{
Reverse(&(List->Next));
return ((List->Data == List->Next->Data) && (IsPalindrome(List->Next->Next)));
}
}
I saw this question at Hackerrank. It's called "Encircular". So this begs the questions: does Google copy questions from Hackerank ? or is this not a real interview question ?
- Lively June 07, 2016To me this seems to be a horrible interview question. It requires some Aha moment which beats the purpose of the interview. But I might be wrong.