Follow 571K Followers Editors Picks Features Explore Grow Contribute About You have 2 free member only stories left this month Sign up for Medium and get an extra one Create PDF in your applications.Follow 571K Followers Editors Picks Features Explore Grow Contribute About You have 2 free member only stories left this month Sign up for Medium and get an extra one Create PDF in your applications.
Trang 1Follow 571K Followers · Editors' Picks Features Explore Grow Contribute About
You have 2 free member-only stories left this month Sign up for Medium and get an extra one
Trang 2Photo by Tim Bennett on Unsplash
OFFICE HOURS
How I cracked my MLE interview
at Facebook
Trang 3My journey to becoming an MLE
Rahul Agarwal Oct 27, 2020 · 14 min read
It was August last year and I was in the process of giving interviews By thatpoint in time, I was already interviewing for Google India and AmazonIndia for Machine Learning and Data Science roles respectively And then
my senior advised me to apply for a role in Facebook London
And so I did Contacted a recruiter on LinkedIn, who introduced me toanother one and my process started after a few days for the role of MachineLearning Engineer
Now Facebook has a pretty different process when it comes to hiringMachine learning engineers They do coding rounds, system design, andmachine learning design interviews to select future employees Now as far
as my experience as a data scientist was concerned I was pretty okay withthe Machine learning design interviews but the other interviews still scared
me I had recently failed a Google interview for Machine Learning SoftwareEngineer in the first round itself just because I was not prepared for DataStructure questions
Trang 4Later as I studied for the FB coding interview, I realized that I took it a littlelight and that I was not prepared for the coding interviews at all.
In this post, I would outline my approach to all these different interviewsand how the whole process went round by round for someone who isinterested in MLE roles at big organizations like FB
So, once I was connected to the recruiter, the next step was a telephonicinterview
1 Telephonic Interview:
This was a very basic Data Structure interview and sort of a basic sanitycheck I guess FB just wants to give you some more time to prepare for thecoming rounds and also see whether it would be worth to call you for theonsite rounds For me, this interview lasted 45 minutes on a Video Call Theinterviewer started by telling me about his profile at Facebook, and in turnasking about my profile for the first 10 minutes or so
Trang 5Then, I was given 2 very basic array and dictionary-based problems to solve.
The interviewer shared a coderpad link on which I had to solve theseproblems in any language of my choice (Not Pseudocode) bug-free withoutany code format options I was asked the Time-based constraints and theSpace-based constraints also for these questions as well The interviewprogressed with me coming up with a bad running time like O(n³) and theinterviewer asking if I can do better and giving hints when needed
As I am not allowed to share the exact questions, I would just share somecomparable in difficulty but not the same public Leetcode questions for you
so that you can understand the difficulty level and practice accordingly
a) Monotonic Array: An array is monotonic if it is either monotoneincreasing or monotone decreasing Return true if and only if the givenarray A is monotonic
b) Valid Palindrome: Given a string, determine if it is a palindrome,considering only alphanumeric characters and ignoring cases
My Plan of Action For this Interview?
Trang 6This was only the second-ever Data Structure interview I was giving and Iwanted to prepare a little after my dismal performance in the first one So, Istarted with just understanding the basics of Data Structures using the
Cracking the Coding Interview book by Gayle Laakmann McDowell Thebook contains a lot of preparation tips as well and you would be prudent to
go and read them The best thing I like about this book is that it's veryconcise unlike Thomas Cormen Introduction to Algorithms and just givesthe right amount of background for coding interviews Every Data structure
is explained very concisely in 2–3 pages, some questions are solved aroundthat particular topic and then a few practice questions are given This bookalso restricts itself in a way that it only has the most often asked Data
Structures For Example, AVL Trees and Red-Black Trees are kept in theadvanced section and not in the trees and graphs chapter as they are oftennot asked very often in a time-bound interview setting
I started my preparation by creating a list of topics I would need to prepare
You could prepare even more topics but these are the bare minimum forthese interviews
Data Structures: Array, Sets, Stack/Queue, Hashmap/Dictionary,Tree/Binary Tree, Heap, Graphs
Trang 7Algorithms: Divide-and-Conquer, DP/memoization, Recursion, BinarySearch, BFS/DFS, Tree traversals.
Then I proceeded to read about them using the Cracking the codinginterview book and solved a lot of easy-level problems and a few medium-level problems on Leetcode for them There are other platforms too topractice online but I liked Leetcode due to its good design with no ads andthe class-based programming structure to the solutions It also provided agood way to search for questions on various topics along with difficulty Ialso gave many Mock Interviews on Leetcode just to practice I did this foraround a week or two, spending around 3–4 hours every day
I also started auditing the Algorithm Specialization on Coursera byUCSanDiego around this time period, which sort of provided me with anidea about the sort of content taught at undergraduate universities to dealwith the coding interviews
I also wrote some blog posts around what I learned and tried to explain itsimply You are free to check them out at my blog
A simple introduction to Linked Lists for Data Scientists
Trang 83 Programming concepts for Data Scientists — Recursion/Memoization,
DP and Binary SearchDynamic Programming for Data ScientistsHandling Trees in Data Science Algorithmic Interview
TLDR; Just jot down the topics you have to prepare for and practice a lot ofeasy questions on each topic And maybe a few medium ones too
Once, I was done with the telephonic interviews, the recruiter returned in ashort period of 1 day and set up a call to explain the process for the onsiteinterview The onsite round was to happen in London and I was genuinelyexcited about the prospect to travel to London An all-paid trip Therewere to happen around 5 more rounds which I am going to talk about next
I took an interview date in 2 months so that I get some time to prepare
Anyways the VISA and the whole process took up taking a little bit morethan that
Trang 9Once in London, I reached the Facebook Office from the hotel theyprovided at around 9 on D Day A full one hour before the scheduled timebecause I was anxious and I normally try to reach interviews on/beforetime(More so when I am giving them) I knew beforehand the wholeitinerary of the day as it was shared with me by my recruiter I also knewwhich interview would happen at what time and who would take it It was
in fact the most organized interview experience I have rather had
2 Onsite Coding Round 1
Trang 10Image by StartupStockPhotos from Pixabay
I have been in Data Science for so long that I read DS as Data Science andnot Data Structures And this interview was essentially a pain point for me
This is something that I learned in a period of 2 months rather than having
my whole experience around it And here I was to be evaluated on thisrather than all my experience and Data Science background But as told to
me by the recruiter they have pretty much-fixed processes and I had to gothrough these rounds for the MLE position So I played along
As for the interview, It started on time and as before the interviewerintroduced himself before going into my profile for a very small time andthen straight jumping into the interview questions This time the questionswere a little more difficult and a lot of time was given to formulating theapproach and around Time and Space complexities of the solution I was
Trang 11asked a medium level string problem which I was able to solve quickly, and
a medium level Binary Search Problem which took most of my time butfinally I was able to solve that Some comparable Problems(Not the sameones) with their brief from Leetcode:
a) Complex Number Multiplication: Given two strings representing twocomplex numbers You need to return a string representing their
multiplication
b) Kth Smallest in sorted Matrix: Given a n x n matrix where each of therows and columns is sorted in ascending order, find the kth smallestelement in the matrix
The interviewer also gave me an option to code on my own laptop which Ihad specifically carried there since the recruiter already told me about theoption of coding on whiteboard/laptop But remember they don’t allowusing any code formatting and IDEs I just had a basic editor to write codewith
My Plan of Action For the Coding Interview?
Trang 12Just the same plan for the telephonic one but more extensive Leetcoding Iremember I did Leetcode straight for 30 days for these coding rounds
around 3–4 hours a day I used to solve as many medium level questions Icould with very little time spent on Hard level questions
3 Onsite Coding Round 2:
Till this time I was in my Data Structure groove and ready for anything thatthe interviewer was gonna throw at me My state of mind being — “ What’sthe worst that could happen?” And so I just carried on The people at
Facebook were really nice as they asked for refreshments before and aftereach interview and took care of not overextending any interview There was
a lot of stock given to the fact that each interview starts at exactly the time
it needs to with a cool-off period of 15 mins between interviews
Again some comparable(Not the same ones) problems in difficulty topractice along with a brief description from Leetcode:
Trang 13a) API Based question Time-Based Key-Value Store: Create a key-value storeclass, that supports two operations — set and get.
b) Merge k-Sorted Lists: You are given an array of k linked-lists lists, eachlinked-list is sorted in ascending order Merge all the linked-lists into onesorted linked-list and return it
My goal in this coding interview was to be able to solve both the problemsthat the interviewer put in a time period of 40 mins But, this was a difficultinterview and I took most of the time of the interview in the second
problem which was of a hard level Though the interviewer gave hints tosteer me towards the right data structure and algorithm In the end, I wasable to solve problem 1 fully and most of problem 2
A tip for interviewees would be to call out all solutions you have along withthe time complexity involved and only start writing code once you bothagree on a good solution
Also, what I found out through these two interviews was that it was reallyhelpful to talk to your interviewers and explain your approach while youare working They sometimes provide hints and sometimes stop you from
Trang 14going to the wrong tangent Even telling your interviewer where you arestuck would help you as it sends out the signal to the interviewer as towhich direction you are thinking in This also makes the whole interviewmore collaborative and I think that is one of the qualities that the
interviewers are looking for in a person
Trang 15Food is just awesome at FB Though, I wasn’t able to enjoy much as I was a little anxious Photo by Dan Gold on
Unsplash
Till this point, I was a little exhausted with all that whiteboard coding andjust the general interview pressure, and since it was around lunchtime, Iwent to the Facebook cafeteria with an assigned colleague/buddy This isthe part where you can ask about the company and this time is not rated onthe interviews so you can be quite open with questions about Facebook lifeand such And you can enjoy a wide variety of food in the Facebook
Cafeteria
4 System Design
Trang 16Photo by Jeswin Thomas on Unsplash
This was another interview which I dreaded As you can see, I was dreadingmost of the interviews as it was quite an unnatural interview format for me
In a system design interview, you are expected to create a service end to end
on a whiteboard Some example problems for you to practice would be:
How would you design Netflix?
How would you design Youtube?
Trang 17How would you design Twitter/Facebook?
While this might look daunting, it is actually really open-ended when youprepare for it As in there are no wrong answers
The way I like to go through this sort of interview is:
1 Design a very basic system that resembles the platform and has thebasic functionality the interviewer has asked for For most of theplatforms, it would involve drawing boxes for server, client and adatabase on a whiteboard
2 Create a list of features I would like to have in the system For example,Follow in social networks, or booking a taxi on Uber, or double ticks inWhatsapp when the message is read, or retweet functionality in Twitter,
or FB newsfeed, etc The sky is the limit when it comes to features andsince we all have seen the features these platforms provide it should not
be that hard to come up with a feature list
3 Add features to it throughout the interview and expand/change on thevery basic design This might involve adding the feature as well as
Trang 18talking about scaling, handling edge cases, talking about the datastructures and databases involved, using caching etc.
4 Continue adding features and evolving the system till the end byasking the interviewer what feature they would like to add based on alist of features I provide them
My Plan of Action For the System Design Interview?
There are pretty good resources on the internet to prepare for this interviewbut I would like to mention two which I found very useful:
System Design Primer by Donne Martin: This is the resource that anyonewho prepares for system design should go through at least once but
honestly many times The most important topics to learn here areperformance, scalability, latency, throughput, Availability, Consistency,CDNs, Databases, Cache, Load balancing etc
Youtube Videos of various system design on the most popular services: I
am talking about the big ones —Netflix/Youtube/WhatsApp/Facebook/Gmail/Amazon etc You can find
a lot of videos on youtube for system designs of all these services Theone YouTuber I would definitely wanna call out would be Techdummies
Trang 19whose videos I watched for all these big platforms And who reallyexplained concepts in the easiest way at least for me.
I spent a week where I just jumped from watching videos to reading therepository by Donne Martin for this interview preparation back and forthand I think that was just the right way Also, it was fun to understand theterms you would find a lot of engineers using, so it was a good learningexperience as well
In the end, the most important thing in this interview is that you need todrive the discussion with minimal input from the interviewer Sometimesthe interviewer might request for a specific feature and you should
implement it but in the end, it is your system and you need to create andadd features you want in the most logical way to succeed in this round
5 Behavioural
This interview tries to look at how you handle difficult situations And, youcan prepare for this interview by assimilating and organizing all the work