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
4 rounds | 8 Coding problems
Interview preparation journey
expand-icon
Preparation
Duration: 4 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
Hard
Online Coding Test
Duration90 minutes
Interview date11 Jul 2019
Coding problem2

This was an online coding round where we were supposed to solve 2 questions under 90 minutes . Both the questions in my set were related to Graphs and were quite tricky and heavy to implement.

1. Count Ways
Easy
24m average time
81% success
0/40
Asked in companies
Goldman SachsGoogleAmazon

You have been given a directed graph of 'V' vertices and 'E' edges.

Your task is to count the tot...

View more
Problem approach

Steps: 

1) Create a recursive function that takes index of node of a graph and the destination index. Keep a global or a static variable count to store the count. Keep a record of the nodes visited in the current path by passing a visited array by value (instead of reference, which would not be limited to the current path).
2) If the current nodes is the destination increase the ...

View more
Try solving now
2. Course Schedule II
Hard
50m average time
50% success
0/120
Asked in companies
AppleUberPhone Pe

You have been given ‘N’ courses and some courses may have prerequisites. Now consider a matrix ‘PREREQUISITES’ of ...

View more
Problem approach

Approach : This problem was based on Topological Sorting .

The first node in the topological ordering will be the node that doesn't have any incoming edges. Essentially, any node that has an in-degree of 0 can start the topologically sorted order. If there are multiple such nodes, their relative order doesn't matter and they can appear in any order.

Algorithm : 

1) Ini...

View more
Try solving now
02
Round
Medium
Face to Face
Duration60 Minutes
Interview date11 Jul 2019
Coding problem2

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

1. Merge Intervals
Moderate
20m average time
80% success
0/80
Asked in companies
SalesforceSAP LabsAmazon

You are given N number of intervals, where each interval contains two integers denoting the start time and the end time for the interval.

View more
Problem approach

Steps : 

1) First, we sort the list as described. 
2) Then, we insert the first interval into our merged list and continue considering each interval in turn as follows - 
2.1) If the current interval begins after the previous interval ends, then they do not overlap and we can 
append the current interval to merged. 
2.2) Otherwise, they do overlap, an...

View more
Try solving now
2. Longest Route
Moderate
15m average time
85% success
0/80
Asked in companies
HSBCFacebookTata 1mg

You are given a 2-D binary matrix "Mat" of dimensions N x M consisting only of 0s and 1s. The cell consisting of 0 means that the cell is blocked and it can...

View more
Problem approach
  1. The idea is to reduce the problem from finding a path from source to destination to finding a path from some node to destination and building our answer up.
  2. From the current cell, we look if there exists a neighbor from where I can reach the destination if no such neighbor exists we return -1.
  3. Else if a path exists we take the longest path then add 1 in it ( to account for ...
View more
Try solving now
03
Round
Medium
Face to Face
Duration50 Minutes
Interview date11 Jul 2019
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. Longest Increasing Subsequence
Moderate
30m average time
65% success
0/80
Asked in companies
HSBCFacebookDisney + Hotstar

For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increasing order.

View more
Problem approach

Approach 1 (Using DP ) :

This is a classic Dynamic Programming problem.
Steps : 
1) Let dp[i] is the longest increase subsequence which ends at nums[i] . 
2) For every i from 0 to n , traverse backwards from j=i-1 to j=0 and check if nums[i]>nums[j].
3) If nums[i]>nums[j] , update dp[i]=max(dp[i] , dp[j]+1)
4) Finally return the maximum element from the DP ...

View more
Try solving now
2. Search In Rotated Sorted Array
Easy
12m average time
85% success
0/40
Asked in companies
GoogleAmazonSiemens

You have been given a sorted array/list 'arr' consisting of ‘n’ elements. You are also given an integer ‘k’.


Now th...

View more
Problem approach

This was a preety standard Binary Search Question and I had solved this question before on platforms like LeetCode and CodeStudio . I was asked this question to test my implementation skills and how well do I handle Edge Cases .

Approach :
1) The idea is to find the pivot point, divide the array in two sub-arrays and perform binary search.
2) The main idea for finding pivot is – fo...

View more
Try solving now
04
Round
Medium
Face to Face
Duration50 Minutes
Interview date11 Jul 2019
Coding problem2

This was also a DSA round with 2 questions of Medium to Hard difficulty . I was expected to follow some clean code and OOPS principles to write the code in this round .

1. Rank from Stream
Moderate
15m average time
85% success
0/80
Asked in companies
Morgan StanleyMicrosoftOla

You are given an array of ‘N’ integers say ‘ARR’ and provided with other integer say ‘K’. Now you have to find the Rank of ‘ARR[K]’.

Note:

View more
Problem approach

Step 1- Making the ‘BST’ :

 

Let insert(TreeNode* <int> ROOT, int VAL) be a function which insert data into ‘BST’.

Now consider the following steps to implement the function :

  1. If ‘ROOT’ is NULL then make a new Node with data and return it.
  2. If 'VAL' is less than data of ‘ROOT’ then do:
    1. Make a recursive call ...
View more
Try solving now
2. LRU Cache Implementation
Moderate
25m average time
65% success
0/80
Asked in companies
CIS - Cyber InfrastructureIntuitGoldman Sachs

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

View more
Problem approach

Approach : 

Structure of an LRU Cache :

1) In practice, LRU cache is a kind of Queue — if an element is reaccessed, it goes to the end of the eviction order
2) This queue will have a specific capacity as the cache has a limited size. Whenever a new element is brought in, it
is added at the head of the queue. When eviction happens, it happens from the tail of the queue.<...

View more
Try solving now
Start a Discussion
Similar interview experiences
company logo
SWE Intern
2 rounds | 5 problems
Interviewed by Facebook
866 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Facebook
1128 views
0 comments
0 upvotes
company logo
SDE - 1
5 rounds | 10 problems
Interviewed by Facebook
504 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 10 problems
Interviewed by Facebook
732 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
97236 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
45397 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
28416 views
6 comments
0 upvotes