At this round, I was asked a binary search type question,
The question would start with very limited information,
I have a bunch of numbers and wanna find the target number. Can you help me?
Then waiting for you to ask more:
What is the input type, Array? Tree? or Streaming?
First, for simplicity, we assume the input is guaranteed valid and sorted.
I give a linear search brute force solution and binary search for improvement,
and the interviewer asks me to prove my thoughts and explain why I choose the binary search.
Then let's start to remove the constraint.
The input is not guaranteed to be valid anymore.
So you have to ask more about what kind of invalid we might meet:
Negative? Overflow? Need to be continuous? Duplicated?
What to do if the data is invalid? Find the closest or return null?
And to note, the binary search is not the best solution now.
For example, we probably need to pre-calculate the input, like sorting.
The following process is around moving the constraint one by one,
For example, we're talking about if the input count being super long,
must over any language support in the environment.
So I might need to think about a distribution solution and merge them.
One thing that deserves to mention,
the interviewer asked me to cover all the tests.
I listed some of the communication in the interview:
"I think there're two test cases you can add."
"In the function, still have one position not been tested in your tests."
Thanks for my luck in arranging with this interviewer.
He's the most professional and kind interviewer I have met,
and the process is just like discussing in day-to-day work,
not the round game like question → try answer → get hint → answer again → pass → repeat next question.
It starts with an intuitive DFS question,
then the follow-up requirement needs depth information,
and we can get it by passing depth + 1 recursively.
After that, the interviewer hopes to change the interface to become a property,
which means I can't pass the depth parameter to the following recursive.
Converting to BFS is the alternative solution for me, and after that,
the interviewer said we want to log the data or sending to the server.
The question is the serialize and deserialize,
because the data is not simply a number like we usually resolve in leetcode,
I have to deal with identity for my custom model.
And also need to provide testing as well, but not as strictly as the phone screening round.
I guess I can get positive feedback in this round.
The final algorithm is about finding the tree's shortest path by giving any node or node that is not in the tree.
The major problem is I don't know that should be a tree,
so I start with a linear search algorithm.
Off course, the interviewer ask to improve the time complexity,
I started to think about how to pre-calculate the input data for the following search.
I got stuck in Array, Binary Search, Graph, etc.
In the end, it consumed a lot of time before closing on the answer,
and I finally implemented it with many hints.
I guess the result is a NO at this round.
The question is very wide this time.
We start from the situation there's a mobile want to ask for data from the server:
the start is just like a small-size system design.
And obviously, the interviewer has his expected path,
during the process, he keeps correct me not to extract the design from the question.
You can imagine I take many times to close the final question,
so I'm in the status about feeling the urgent pressure of running out of time.
At last, the interviewer asked me to use my design to call a system API.
It's a disaster here. I made a huge mistake in the final 1 min.
For example, you can imagin the mistake is like update UI in the background thread,
or make a retain cycle to cause a memory leak.
The usage is written down in the Apple document. It clearly said my usage approach was inefficient,
and I strongly feel this is what the interviewer wants to ask whether I know it or not. :(
Sadly, I have read the document before, but it was 5+y ago…
I'm not surprised to get a No, or even worse.
It was similar to the Facebook system design in my previous experience.
I think this is because it's the mobile system design.
The request is very clear, no need to define the feature from scratch.
(In Facebook interview even has UI in the question)
I think nothing special here. Just share what I want to do based on my daily experience.
One part not in my prediction is the interviewer still asks me to code,
and the implementation is close to completion.
Not allow pseudocode or some details I think can skip,
for example, I wrote "display the error message",
and he asked me to complete how to display the error message.
By the way, if someone has no idea about how to do mobile system design,
I usually consider latency, consistency, and security.
Latency can extend to cache or thread topics.
Consistency can extend to a single source of truth.
Security is something about privacy that also impacts the storage solution.
Googlyness and Leadership Round
It's very nice talking.
The interviewer asks about a situation and answers with previous experience.
There are no special questions.
I can find them in any behavior questions example list.
Ex: different opinion, unreasonable request, etc
I feel that communication skill is the most important for a google interview.
Once you get the final question, it is not very difficult to implement it.
And this is hard to practice in Leetcode if I focus on getting the green pass.
I'd share my practice approach.
My practice way is forcing me to explain the logic in the comment before starting to code.
During coding, once I get stuck,
I will stop and go back to the logic comment until I fill that implementing is just converting my thought