## Google Interview Questions

- 0of 0 votes
How 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?

- 0of 0 votes
Given list of schedules for different flights in a month, determine maximum number of flights that can be in the air anytime in that month.

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

- 0of 0 votes
Given a list of N threads detect a deadlock in the system.

- 1of 1 vote
Google

Given two lowercase strings, S1 and S2, sort S1 in same order as S2.

If a character in S1 doesn't exist in S2, put them at the end. If S1 is "program" and S2 is "grapo", then return "grrapom".

- 0of 0 votes
Using Google BigQuery documentation, provide at least three (3) possible failure modes that could cause following customer problem:

""" 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.

- 0of 0 votes
BIG DAT AND MACHINE LEARNING

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?

- 0of 0 votes
A sample state of ‘a’:

[[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

- 0of 0 votes
Design a turn-by-turn application. Prioritize v1 features and tell why

- 2of 2 votes
Feb On-site Google

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.

- 2of 2 votes
Feb On-site Google

Print all numbers satisfying the expression 2^i * 5^i (where i, j are integers i >= 0 and j >= 0) in increasing order up to a given bound N.

2^i stands for power(2, i).

- 0of 0 votes
check if there are two subarrays in an array are identical

- 0of 0 votes
comparison of two strings if they are the same, use o(1) space

abc \ b is equal to ab

abc \ ca equals abcA

\ b = backspace

\ c = CapsLock

- 0of 0 votes
convert Prefix to Postfix using recursion

+ * A B / C D -> A B * C D / +

- 0of 0 votes
Design a dictionary with historical records

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

- 0of 0 votes
CSS 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.

- 0of 0 votes
`Given 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`

- 0of 0 votes
convert a Sorted linkedList to complete BST

- 0of 0 votes
Give N socks, there is no guarantee that each can be paired, socks two colors, black and white, you need to pair them

- 0of 0 votes
css color format # abcdef, another abbreviated color format # rgb

(Converted to the previous format, ie, #rrggbb.) Now give your #abcdef, the first color format, to find the two least different colors, #rgb.

- 0of 0 votes
Google Fucked up question.

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.

- 0of 0 votes
Given list of edge in the graph, find the number of reversed pairs,(1,2)

and (2,1) are such pair. Follow up: How to implement the distributed version.

- 0of 0 votes
Implement 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+:`int 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; }`

- 0of 0 votes
An n * m matrix represents an array of computers, giving you a List <int []> that represents the coordinates of the broken computer.

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,

- 0of 0 votes
A 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.

- 0of 0 votes
Find if the shorter string is a subsequence of the longer string

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

- 0of 0 votes
To several bus lines, each line is a two-way line, such as:

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

- 0of 0 votes
Determine whether the inorder of n binary trees is the same

- 0of 0 votes
Give you a csv file There are three columns are id, parent, weight Then give you a class Node which has these three fields

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.

- 0of 0 votes
Give a chessboard, check if a group of white chesses are surrounded by all black chesses.

- 0of 0 votes
Given a list of relationship of report

A reported to D, D reported to Z, who are reported to Z