Google Interview Questions
- 0of 0 votes
AnswersTable: Customers
- prasad.hybris May 02, 2018 in United States
id | name
1|alice
2|bob
3|carol
Table: Orders
id | customer_id | content
1|1|House
2|2|car
3|2|dog
4|10|cow
please write a query which returns all of the invalid orders (where invalid means their customer_id does not have an associated customer)
4|10|cow| Report Duplicate | Flag | PURGE
Google Technical Support Engineer Database - 1of 1 vote
AnswersSuppose you have a list of tasks which need to be executed. Some of these tasks have dependencies which must be executed before they are. Please provide a method which, when given a list of tasks, will provide a valid ordering in return.
- prasad.hybris May 02, 2018 in United States
Example:
Input: [ A, B, C, D ]
A <- B, C
B <- C, D
D <- C
Return: [ C, D, B, A ]| Report Duplicate | Flag | PURGE
Google Technical Support Engineer Trees and Graphs - 1of 1 vote
AnswersPrint (or return) the longest movie title found by successively matching the last and first words in each title, joining to form new titles, given a file containing a list of movie titles.
- gsgy11 April 30, 2018 in United States
For example: 'OF MICE AND MEN' and 'MEN IN BLACK' join to form 'OF MICE AND MEN IN BLACK'.
You could further join 'OF MICE AND MEN IN BLACK' wth 'BLACK MASS' to form 'OF MICE AND MEN IN BLACK MASS'.
The longest title I found (at 143 characters is): WENT TO CONEY ISLAND ON A MISSION FROM GOD BE BACK BY FIVE WIVES THREE SECRETARIES AND ME WITHOUT YOU CANT TAKE IT WITH YOU WERE NEVER LOVELIER| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersYou are given an array of strings. For example, ["AB", "BC", "FOO", "ZA", "BAZ"]
- thriver April 22, 2018 in United States
- Output strings where you can get from one to the other using any ROT transformation.
ROT_1(AB) = BC
ROT_1(BC) = CD
ROT_25(AB) = ZA
AB,BC you can go from one to the other using ROT_1
Input: list of strings
Output: strings where you can get from one to the other using any ROT transformation.
Example:
Input : ["AB", "BC", "FOO", "ZA", "BAZ"]
Output: [ [ab, bc] , [ab, za] ]
AB,BC because you can go from one to the other using ROT_1
AB,ZA because you can go from one to the other using ROT_25
Do not return FOO, BAZ you can’t get from one to the other.| Report Duplicate | Flag | PURGE
Google Software Developer - -3of 3 votes
AnswerHow do you go about the phone interview for troubleshooting a problem, say "my computer has become slow 3 times from the last week.". Can someone please give the detailed explanation of how to go about this question. Also, "my internet is not working". How to go about these 2 troubleshooting problems in the phone interview?
- JayswalShubh April 21, 2018 in Australia| Report Duplicate | Flag | PURGE
Google Technical Support Engineer - 1of 1 vote
AnswerGiven list of schedules for different flights in a month, determine maximum number of flights that can be in the air anytime in that month.
- sanjureddy.v April 14, 2018 in United States
Input : list of schedules for flights.- spread over a month.
output: a number - maximum flights that can be in the air
Assumptions: 1. All the given times are in a specific timezone( like GMT).
2. Given Schedules can be any time in the month| Report Duplicate | Flag | PURGE
Google SDE1 Algorithm - 0of 0 votes
AnswerGiven a list of N threads detect a deadlock in the system.
- jddjjd007 April 12, 2018 in United States| Report Duplicate | Flag | PURGE
Google Algorithm - -2of 2 votes
AnswersUsing Google BigQuery documentation, provide at least three (3) possible failure modes that could cause following customer problem:
- prasad.hybris April 03, 2018 in United States
""" I am ingesting data regularly in streaming mode into my mobile-events table, querying the data back however shows timestamps six hours behind. Please help. """
You can use public BigQuery documentation for the client side and make assumptions about the serving side based on your experience with other similar products, provided the serving stack spreads across multiple machines and microservices.| Report Duplicate | Flag | PURGE
Google Cloud Support Associate Database - -1of 1 vote
AnswersBIG DAT AND MACHINE LEARNING
- prasad.hybris April 03, 2018 in United States
Hi Cloud Support,
I have records like this in BigQuery:
logs.datetime: ''2017-07-01T13:51:03"
logs.type: "worker"
logs.message: "Starting pipeline"
apps.name: "reader_af45c9"
apps.log_type: "worker"
And I'm trying to run this query:
select logs.datetime, logs.type, logs.message, apps.name
from logs inner join apps on logs.type = apps.log_type
where logs.datetime > "2017-07-01T00:00:00" and logs.datetime < "2017-07-02T00:00:00"
group by apps.name;
But it's not working. Can you help me?| Report Duplicate | Flag | PURGE
Google Cloud Support Associate Database - -1of 1 vote
AnswersA sample state of ‘a’:
- prasad.hybris April 03, 2018 in United States
[[2, NULL, 2, NULL],
[2, NULL, 2, NULL],
[NULL, NULL, NULL, NULL],
[NULL, NULL, NULL, NULL]]
FUNCTION foo()
FOR y = 0 to 3
FOR x = 0 to 3
IF a[x+1][y] != NULL
IF a[x+1][y] = a[x][y]:
a[x][y] := a[x][y]*2
a[x+1][y] := NULL
END IF
IF a[x][y] = NULL
a[x][y] := a[x+1][y]
a[x+1][y] := NULL
END IF
END IF
END FOR
END FOR
END FUNCTION| Report Duplicate | Flag | PURGE
Google Cloud Support Associate Algorithm - -2of 2 votes
AnswersDesign a turn-by-turn application. Prioritize v1 features and tell why
- dsan April 01, 2018 in United States| Report Duplicate | Flag | PURGE
Google Program Manager - 4of 4 votes
AnswersFeb On-site Google
- aonecoding March 10, 2018 in United States
DP Problem. Given the length and width of a matrix, get the number of paths from bottom-left to bottom right.
You may only walk into those 3 directions ➡ (right) ↗ (upper-right) ↘ (lower-right) at each point.
Follow-up: optimize 2d DP to 1d DP of linear extra space.
Follow-up: what if some cells are blocked
System Design
Availability test/debug on distributed system. Discussed and drafted about failover, replication, NoSQL etc.
Interviewer seemed to be expecting more but time ran out.| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
Answerscheck if there are two subarrays in an array are identical
- ajay.raj March 01, 2018 in United States| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
Answerscomparison of two strings if they are the same, use o(1) space
- ajay.raj March 01, 2018 in United States
abc \ b is equal to ab
abc \ ca equals abcA
\ b = backspace
\ c = CapsLock| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
Answerconvert Prefix to Postfix using recursion
- ajay.raj March 01, 2018 in United States
+ * A B / C D -> A B * C D / +| Report Duplicate | Flag | PURGE
Google Backend Developer - 0of 0 votes
AnswersDesign a dictionary with historical records
- ajay.raj March 01, 2018 in United States
t0: hdict = HistoricalDict ()
t2: hdict.set ('foo', 1)
t4: hdict.set ('foo', 2)
t5: hdict.get ('foo', t5) -> 2
t6: hdict.get ('foo', t3) -> 1
t7: hdict.get ('foo', t0) -> None| Report Duplicate | Flag | PURGE
Google Java Developer - 0of 0 votes
AnswersCSS colors can be defined in the hexadecimal notation "#rgb", a shorthand for "#rrggbb". For example, "#03f" is equivalent to "#0033ff". Suppose the similarity between two colors "#abcdef" and "#ghijkl" is defined as (-(ab-gh)^2 - (cd-ij)^2 - (ef-kl)^2), write a function that accepts a color in the "#abcdef" format and returns a "#rgb" color that is most similar to the input. For example, given "#09f166", "#1e6" should be returned.
- ajay.raj March 01, 2018 in United States| Report Duplicate | Flag | PURGE
Google Java Developer - 0of 0 votes
Answers
- ajay.raj March 01, 2018 in United StatesGiven a binary tree, output the maximum EVEN sum along any path 10 / \ 2 5 / \ \ 1 101 13 Maximum even sum = 101 +2 +10 + 5 = 118
| Report Duplicate | Flag | PURGE
Google Java Developer - 0of 0 votes
Answersconvert a Sorted linkedList to complete BST
- ajay.raj February 23, 2018 in United States| Report Duplicate | Flag | PURGE
Google Java Developer - 0of 0 votes
AnswersGive N socks, there is no guarantee that each can be paired, socks two colors, black and white, you need to pair them
- ajay.raj February 22, 2018 in United States| Report Duplicate | Flag | PURGE
Google SDE1 - 0of 0 votes
Answerscss color format # abcdef, another abbreviated color format # rgb
- ajay.raj February 22, 2018 in United States
(Converted to the previous format, ie, #rrggbb.) Now give your #abcdef, the first color format, to find the two least different colors, #rgb.| Report Duplicate | Flag | PURGE
Google SDE1 - 1of 1 vote
AnswersGoogle Fucked up question.
- hprem991 February 21, 2018 in United States
Given a random list of appointments (Start Date , End Date). Find all the appointments that are colliding.
This pretty easy looking question screwed me up today.There are tons of edge cases, I couldn't complete em all and 45 minutes pass like 15 minutes while explaining and coding same time.| Report Duplicate | Flag | PURGE
Google Software Engineer Coding - -1of 1 vote
AnswersGiven list of edge in the graph, find the number of reversed pairs,(1,2)
- ajay.raj February 21, 2018 in United States
and (2,1) are such pair. Follow up: How to implement the distributed version.| Report Duplicate | Flag | PURGE
Google Java Developer - 0of 0 votes
AnswersImplement a function that takes two strings, s and x, as arguments and finds the first occurrence of the string x in s. The function should return an integer indicating the index in s of the first occurrence of x. If there are no occurrences of x in s, return -1.
Example:
For s = "AGoogleInterviewIsAwesome" and x = "IA", the output should be
strstr(s, x) = -1;
For s = "AGoogleIsAwesome" and x = "IsA", the output should be
strstr(s, x) = 10.
Apparently, my solution was not efficient enough with string lengths that are 2000+:
- btmakusha February 19, 2018 in United States for Searchint findFirstSubstringOccurrence(String s, String x) { int sLen = s.length(); int xLen = x.length(); int tracker = 0; if (sLen == xLen) { if (s.equals(x)) { return 0; } else { return -1; } } else { if (xLen >= 1) { for (int index = 0; index < sLen; index++) { if (s.charAt(index) == x.charAt(tracker)) { tracker++; if (tracker == xLen) { return index - (xLen - 1); } } else { index -= tracker; tracker = 0; } } } } return -1; }
| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersAn n * m matrix represents an array of computers, giving you a List <int []> that represents the coordinates of the broken computer.
- ajay.raj February 18, 2018 in United States
Now we start from (0,0) repair computer requirements:
1. You must finish all the broken computers in the current line to get to the next line
2. To go to the next line, the mechanic must first return to the far left or right of this line
And then find repair each computer order that has the minimum access distance,| Report Duplicate | Flag | PURGE
Google Java Developer - -1of 1 vote
AnswersA robot can only be moved one step to the right (x + 1) at a time while moving upward or downward or horizontally (y-1, y + 1, y) , given the starting and ending positions, and a series of points must pass, ask how many kinds of ways from start to end.
- ajay.raj February 17, 2018 in United States| Report Duplicate | Flag | PURGE
Google Java Developer - -1of 1 vote
AnswersFind if the shorter string is a subsequence of the longer string
- ajay.raj February 16, 2018 in United States
Output the second index corresponding to the first one, requiring output only If there is only one match, and false if there is more than one pair
a b c d e f g, a b -> [0,1]
a b b c, ab c -> False| Report Duplicate | Flag | PURGE
Google Backend Developer - -1of 1 vote
AnswerTo several bus lines, each line is a two-way line, such as:
- ajay.raj February 16, 2018 in United States
0: A <-> B <-> D
1: C <-> D
give you a start and end, find the path through the least station. followup
Asked the least transfer case| Report Duplicate | Flag | PURGE
Google Backend Developer - -1of 1 vote
AnswersDetermine whether the inorder of n binary trees is the same
- ajay.raj February 14, 2018 in United States| Report Duplicate | Flag | PURGE
Google Java Developer - 0of 0 votes
AnswersGive you a csv file There are three columns are id, parent, weight Then give you a class Node which has these three fields
- ajay.raj February 14, 2018 in United States
But you also have the option of adding more fields for you to print out all the node's subwebs.
The definition of subweight is the sum of the node's weight plus the subweight of his children.| Report Duplicate | Flag | PURGE
Google Java Developer