Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Facebook interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Facebook
upvote
share-icon
5 rounds | 10 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 Months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Face to Face
Duration60 Minutes
Interview date5 Jun 2015
Coding problem2

This was a Data Structures and Algorithms round with preety good questions . I was expected to come up with an efficient approach and code it as well .

1. K Closest Points To Origin

Moderate
25m average time
75% success
0/80
Asked in companies
AppleFacebookAmazon

Your house is located at the origin of a 2-D plane. Y...

View more
Problem approach

I solved it using priority queue with a custom comparator that compares points according to their Euclidean Distance with respect to the Origin.
Steps : 
1) Initiliase a priority queue with a custom comparator.
2) Push all the points to the priority queue.
3) Pop the first k elements of the priority queue and store it in vector called answer.
4) Finally output the contents o...

View more
Try solving now

2. Power Set

Easy
15m average time
85% success
0/40
Asked in companies
Paytm (One97 Communications Limited)AdobeGoogle

You are given a sorted array of 'N' integers. You have to generate the power set for this array where each subset of this power set is individually sorted.

View more
Problem approach

Given,a set of n elements I was supposed to print all the subsets of this set . I was famiiar with this question and had already solved it in LeetCode and CodeStudio so coding it in the first go was not so hard for me .

Approach : I solved it using bitmasking . The main intuition was if I have a binary number like 1001 , I would take only the 0th element and the 3rd element of the array ...

View more
Try solving now
02
Round
Hard
Face to Face
Duration50 Minutes
Interview date5 Jun 2015
Coding problem2

This was also a DSA round where I was asked to code only one of the questions but I eventually ended up coding both as I had some spare time and explained my approches very smoothly to the interviewer . This round went preety well .

1. Roman Numeral To Integer

Easy
15m average time
85% success
0/40
Asked in companies
UberFacebookBarclays

You are given a string 's' that represents a Roman number. Convert the Roman number to an integer and return it.


Roman numerals are represented ...

View more
Problem approach

This question was preety straightforward and was asked to check my implementation skills and how well do I handle some Edge Cases . So I was expected to directly code it shortly after explaining my approach . 

Approach :
1) Initialise a Map and map all the standard roman numerals to their respective integer counterparts.
2) Run a loop till the length of the Roman Numeral and t...

View more
Try solving now

2. Pair Sum

Easy
15m average time
90% success
0/40
Asked in companies
AccentureGrofersOla

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.

...
View more
Problem approach

Initialize a list to store our results. For each element in the array 'ARR[i]', check if ('ARR[i]' + ‘ARR[j]’), equals to given sum or not, where ‘i’ < ‘j’ < ‘N’. If the condition matches, add the pair('ARR[i]', ‘ARR[j]’) to the list. Sort the list of pairs as per the given output format and return this list.

Try solving now
03
Round
Medium
Face to Face
Duration50 Minutes
Interview date5 Jun 2015
Coding problem2

This was also a DSA round with 2 questions . One was implementation heavy and the other was related to recursion and so I handled it carefully so that my code does not run into TLE or Segmentation Fault.

1. Arithmetic Expression Evaluation

Moderate
30m average time
70% success
0/80
Asked in companies
AdobeFacebookMicrosoft

You are given a string ‘expression’ consists of characters ‘+’, ‘-’, ‘*’, ‘/’, ‘(‘, ‘)’ and ‘0’ to ‘9’, that represents an Arithmetic Expression in Infix Notation. Your task is to evaluate this Arithmetic Expr...

View more
Problem approach

The problem statement was quite straight forward but I was asked to code the Space Optimised Approach. I had previously solved this question using a stack but without using any extra space required a liitle bit of observation that the input vector given can also be used as a stack .

Approach 1 (Using Stack ) : 
1) If the current token is a operand (number), push it into the stack...

View more
Try solving now

2. Remove Duplicates from Sorted Array

Easy
15m average time
85% success
0/40
Asked in companies
WalmartAppleCognizant

You are given a sorted integer array 'arr' of size 'n'.


You need to remove the duplicates from the array such that each element appears only once.

<...
View more
Problem approach

I solved this problem using recursion . From the given problem itself , it is clear that if I solve the same problem for a smaller string say the subtring from 1 to n (call it s). I will simply append all the mappings of the first character to all the strings that would come from the substring s . 

Approach :
1) Create a recursive function (vectorrecur(string s)) which would retu...

View more
Try solving now
04
Round
Medium
Face to Face
Duration50 Minutes
Interview date5 Jun 2015
Coding problem2

This was a typical System Design round where I was asked about the various features of Facebook and what sort of data structures and algorithms are used in implementing them .

1. System Design Question

How does Facebook store likes/dislikes ?

Problem approach

Approach : 
1) We can keep one counter variable which counts the overall likes in that same document where the post's data is present. 
2) And store the details/uids of people who liked it in different documents( this way, when we tap on details, then only we'll need to fetch these docs) and, we can setup a cloud func whch updates that counter whenever someone likes/dislikes.&nb...

View more

2. System Design Question

How does Facebook implement graph search ?

Problem approach

Answer : 
1) Facebook graph search, can be considered as a complex graph with entities like people, pages, photos and videos, while the edges are relationships among all of these entities. 
2) Unicorn- standard inverted index system optimized for the needs of Facebook is used for having all the information on the main memory so the query processing doesn't involve any disk acces...

View more
05
Round
Medium
Face to Face
Duration50 Minutes
Interview date5 Jun 2015
Coding problem2

This was a preety intense round as I was grilled more on my System Design concepts but eventually I was able to asnwers all the questions with some help from the interviewer.

1. Technical Question

What is Hadoop and why is it used ?

Problem approach

Answer :

Hadoop is an open source framework from Apache and is used to store process and analyze data which are very huge in volume. Hadoop is written in Java and is not OLAP (online analytical processing). It is used for batch/offline processing.It is being used by Facebook, Yahoo, Google, Twitter, LinkedIn and many more. Moreover it can be scaled up just by adding nodes in the cluster....

View more

2. System Design Question

How does Facebook Chat works ?

Problem approach

I was asked to answer this question w.r.t 2 very important aspects on how a chat system becomes more engaging to its users. 

Answer :

Real-time messaging : 

1) The method FB chooses to get text from one user to another involves loading an iframe on each Facebook page, and having that iframe’s Javascript make an HTTP GET request over a persistent connection that do...

View more
Start a Discussion
Similar interview experiences
company logo
SWE Intern
2 rounds | 5 problems
Interviewed by Facebook
957 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Facebook
1217 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Facebook
611 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 10 problems
Interviewed by Facebook
843 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
100847 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
47169 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
29633 views
6 comments
0 upvotes