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

Facebook

4 rounds | 8 Coding
problems

Preparation

Duration: 4 Months

Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS

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

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.

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.

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

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

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 .

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

View more

Problem approach

- 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.
- 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.
- Else if a path exists we take the longest path then add 1 in it ( to account for ...

View more

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 .

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

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

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 .

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 :

- If ‘ROOT’ is NULL then make a new Node with data and return it.
- If 'VAL' is less than data of ‘ROOT’ then do:
- Make a recursive call ...

View more

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

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Which data type is considered as a non-primitive data type?

Start a Discussion

Similar interview experiences

SWE Intern

2 rounds | 5 problems

Interviewed by Facebook

958 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 3 problems

Interviewed by Facebook

1218 views

0 comments

0 upvotes

SDE - 1

5 rounds | 10 problems

Interviewed by Facebook

593 views

0 comments

0 upvotes

SDE - 1

4 rounds | 10 problems

Interviewed by Facebook

846 views

0 comments

0 upvotes

Companies with similar interview experiences

SDE - 1

5 rounds | 12 problems

Interviewed by Amazon

100964 views

24 comments

0 upvotes

SDE - 1

4 rounds | 5 problems

Interviewed by Microsoft

47258 views

5 comments

0 upvotes

SDE - 1

3 rounds | 7 problems

Interviewed by Amazon

29675 views

6 comments

0 upvotes