Google Interview Questions
- 0of 0 votes
AnswersYou should transform an structure of multiple tree from machine A to machine B. It is a serialization and deserialization problem, but i failed to solve it well.
You could assume the struct is like this:struct Node{ string val; vector<Node*> sons; }
and in machine A, you will given the point to root Node, and in machine B,you should return a pointer to root Node.
- lxfuhuo July 30, 2015 in China| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
Answershow would you design a microwave for the blind?
- harushimo July 24, 2015 in United States| Report Duplicate | Flag | PURGE
Google Program Manager design - 0of 0 votes
AnswersHow would you increase Youtube revenue?
- harushimo July 24, 2015 in United States| Report Duplicate | Flag | PURGE
Google Program Manager Business Question - -3of 3 votes
AnswersHow much is Youtube Revenue
- harushimo July 24, 2015 in United States| Report Duplicate | Flag | PURGE
Google Program Manager Business Question - 1of 1 vote
AnswersWrite a program in that determines the members and parents of nested groups without using recursion.
These are the requirements.
1. A group can have 0 or more members.
2. A group can be member of one or more groups
3. A group can be member of itself.
4. If there is a path from a group either directly or through multiple hops, then that user is considered as member of the group.
5. A group can have users or groups as members
EX: Input looks like thisvar groupMembers = new Dictionary<string, HashSet<string>> { { "G4", new HashSet<string> { "U1","G1"} }, { "G1", new HashSet<string> { "G2","G3","G6"} }, { "G3", new HashSet<string> { "G3","G5"} }, { "G2", new HashSet<string> { "G4","U2"} }, { "G5", new HashSet<string> { "U2","G6"} }, { "G6", new HashSet<string> { "U3"} }, };
Signature of function is:
private List<MyGroup> FindMembers(Dictionary<string, HashSet<string>> groupMembers)
You need to make sure that you take care of cycles in the graph and not go into infinite recursion.
Output should look like a list of groups where a group is as follows.private class MyGroup { public string Identity { get; set; } public Dictionary<string, MyGroup> MemberOf { get; set; } public Dictionary<string, MyGroup> Members { get; set; } public HashSet<string> Users { get; set; } public MyGroup(string name) { this.Identity = name; this.MemberOf = new Dictionary<string, MyGroup>(); this.Members = new Dictionary<string, MyGroup>(); this.Users = new HashSet<string>(); } }
Each group object should contain all the groups it's a memberOf (directly or indirectly), all the groups that are it's members (directly or indirectly) and all users that are it's members.
- enok July 23, 2015 in United States| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersGiven a string representing relative path write a function which normalizes this path (i.e. replaces "..").
- Eugene July 16, 2015 in United States
Example:
input: \a\b\..\foo.txt
output: \a\foo.txt| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersYou are given an array representing integer. Write a function which increments this integer.
- Eugene July 16, 2015 in United States
Example: input [1,2,3] (represents 123) -> output [1,2,4]| Report Duplicate | Flag | PURGE
Google Software Developer - 4of 4 votes
AnswersGiven an unbalanced binary tree, write code to select a node at random (each node has an equal probability of being selected).
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 1of 1 vote
AnswersFind a duplicates in an array of length n. The values are positive integers in the range between 1 .. n-1
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersCount triangles in an undirected graph where a triangle is a unique set of three vertices connected to one another.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 0of 0 votes
AnswersIn 5 minutes write a code which checks if a given number is a power of two.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersCheck if two given words are anagrams of each other.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 3of 3 votes
AnswersGiven two sorted arrays find the element which would be N-th in their merged and sorted combination.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 1of 1 vote
AnswersGiven a BST with unique values find in a given tree a value closest to a given value X.
- tested.candidate July 14, 2015 in Poland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersHow would you store the relations in a social network like Facebook and implement a feature where one user receives notifications when their friends like the same things as they do?
- tested.candidate July 13, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - -1of 1 vote
AnswersDesign the front end of Google Calendar
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 0 votes
AnswersDesign YouTube view-counting feature
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 0 votes
AnswerDesign Google Suggest
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - -1of 1 vote
AnswersDesign Gmail backend (data storage and API)
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 7of 11 votes
AnswersThe "surpasser" of an element in an array is defined as the number of elements that are to the "right" and bigger than itself.
- carchen2015 July 10, 2015 in United States
Example:
Array:
[2, 7, 5, 5, 2, 7, 0, 8, 1]
The "surpassers" are
[5, 1, 2, 2, 2, 1, 2, 0, 0]
Question: Find the maximum surpasser of the array.
In this example, maximum surpasser = 5| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersFind the longest common prefix in a list of phrases. For instance; "i love all dogs", "i love cats" should return "i love".
- tamaracmike July 08, 2015 in United States| Report Duplicate | Flag | PURGE
Google Algorithm - 2of 2 votes
AnswersGiven a binary tree, implement an iterator that will iterate through its elements.
- carlosgsouza July 07, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 10of 10 votes
AnswersYou are given four integers 'a', 'b', 'y' and 'x', where 'x' can only be either zero or one. Your task is as follows:
- autoboli June 30, 2015 in United States
If 'x' is zero assign value 'a' to the variable 'y', if 'x' is one assign value 'b' to the variable 'y'.
You are not allowed to use any conditional operator (including ternary operator).
Follow up: Solve the problem without utilizing arithmetic operators '+ - * /'.| Report Duplicate | Flag | PURGE
Google - 0of 2 votes
AnswersGiven a List of Strings, return the number of sets of anagrams.
- SK June 30, 2015 in United States
For instance, given:
<abc,cab,dac,beed,deb,few,acd>
return 5| Report Duplicate | Flag | PURGE
Google Algorithm - 1of 1 vote
AnswersDesign a cache module for an image server. The server accepts image requests from users and sends them back the images. The cache should always hold in-memory the 10 most recently requested images. The cache should also support multiple requests simultaneously
- assaf.keret1 June 28, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Coding - 3of 3 votes
AnswersDesign an application which sends the user the 10 closest hotels based on his geo location.
- assaf.keret1 June 21, 2015
When i asked roughly how many hotels in total are we talking about, i was asked to estimate how many hotels are there in the world...| Report Duplicate | Flag | PURGE
Google Software Engineer in Test - 4of 4 votes
AnswersYou are given 2 documents. We want to know how similar they are through N-Grams.
- um01 June 20, 2015 in United States
Given an input n (n = number of word in the Ngram) and two documents(strings) find the intersection of the NGrams of two document.
E.g doc1 = 'This is a dog'
doc2 = 'This is a cat'
n = 3
Ngrams for doc1 = 'This is a', 'is a dog'
Ngrams for doc2 = 'This is a', 'is a cat'
Output 'This is a'
Find a efficient way and give its complexity.| Report Duplicate | Flag | PURGE
Google Software Engineer - 2of 2 votes
Answersstd C library has pow(x, n) function - implement that function
- kumarr.arvind June 20, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 1of 1 vote
AnswersGiven a sorted array and n, find the count of sum of 2 numbers greater than or equal to n
- Killbill June 17, 2015 in United States| Report Duplicate | Flag | PURGE
Google