YOE 3
Location US
Behavioural
3 questions with a focus on diversity/inclusion.
How would you design/test a product to make sure its diverse/inclusive to all users
Tell me about a time where you changed a person's bias.
Tell me about a time where you had to accomodate for another person's working style.
Coding 1
The interviewer for this round was awesome. Gave hints and I felt like they wanted me to do well.
Q1
For a given string, check whether a string is "smashable". Smashable means whether a word can be reduced to a single character, which is in your predefined dictionary of words, and every intermediate word during the reduction should also lie in the dictionary.
For example -
Given: SPRINT
PRINT
PINT
PIT
IT
I
Followup: Make this more efficient(memoization)
Q2
You have a clock with the following functions.
getCurrentTime()
advHour()
adv15min()
adv5min()
adv1min()
And a time class to represent the time (12 hour with am/pm).
class Time {
int hour;
int min;
boolean am_pm;
}
Implement a function to set the clock's time to a given time in the least amount of operations;
int setTime(Clock clock, Time time)
Coding 2
Interviewer for this round was less helpful. Didn't give any hints.
Given a calculation class where you intialize values for a,b,c and the following function f(x) = ax^2 + bx + c, and a list of numbers, apply this function all values in the list.
class Calculation {
int a;
int b;
int c;
int[] calculate(int[] arr)
}
Followup: We want the output array to be sorted. Can we do better than O(nlogn)?
I think you are supposed to find the inflection point of the function using binary search then use a 2 pointer approach to sort the output array in O(n).
Coding 3
Worst interview experience I've ever had. No problem statement given or any examples. Just asked me how you would delete something from a tree.
This was what I was given:
class TreeNode {
int parentIndex;
// data
}
List nodes;
At first I thought he wanted me to implement delete in a binary tree. If that's the case then TreeNode should have a reference to its children.
I thought ok I can iterate through the list to delete the node and I'm done, I didn't even think about the parentIndex at this point.
Then he finally clarified that the parentIndex inside the TreeNode references to its parent node in the list.
Finally we get to the real problem. He asked me again how I would delete a node from a Tree taking into consideration the child nodes of the node that's deleted.
What a waste of 15 min. I think calling the class TreeNode was to intentionally mislead me into thinking this was a normal binary tree question.
There are three things we can do to the children nodes of a deleted node, delete all its children, promote a child to be the new node and maintain the structure or make the deleted node's parent the parent of these nodes.
He asked me to choose one to implement.
At this point I knew my chances at Google were gone because I was already pissed off by his attitude and wasted way too much time getting to the real question.
I chose option 1 and failed to implement it. The hard part is updating the parentIndexes of the nodes that remain because every deleted node could change the parentIndex for nodes before/after it.
Coding 4
At this point I already gave up. I knew my second coding round didn't go well and neither did the last one.
Interviewer this round was nice and gave the problem statement and an example.
Calculate the minimum time it would take for a car to go X laps around a racetrack given a collection of tires
A tire can finish a lap in t time but every subsequent lap will take longer because of degradation.
Tire {
double t
double d
}
Tire1{2, 2}
Tire2{4, 1.5}
Ex for 3 laps
Tire 1 = 2 + 2 * 2 + 2 * 2 * 2
Tire 2 = 4 + 4 * 1.5 + 4 * 1.5 * 1.5
The more laps you do, the bigger the degradation, resulting in taking more time to complete the lap.
Followup: What if we can do a pitstop every lap and switch tires but it will take P time to do the pitstop?
How would we calculate the minimum time now?
Looks like some hard DP problem to me. Wasn't able to solve.