Upload Button Icon Add office photos

Facebook

Compare button icon Compare button icon Compare

Filter interviews by

Facebook Software Engineer Interview Questions and Answers

Updated 15 Jan 2025

8 Interview questions

A Software Engineer was asked
Q. Given an array of Integers, find the length of the Longest Increasing Subsequence and print the sequence.
Ans. 

Find the length of longest increasing subsequence and print the sequence from an array of integers.

  • Use dynamic programming to solve the problem

  • Create an array to store the length of longest increasing subsequence ending at each index

  • Traverse the array and update the length of longest increasing subsequence for each index

  • Print the sequence by backtracking from the index with the maximum length

  • Time complexity: O(n^2...

A Software Engineer was asked
Q. Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get(key) - Get the value (will always be positive) of the key if the key exists in the ...
Ans. 

LRU Cache is a data structure that stores the most recently used items and discards the least recently used items.

  • Use a doubly linked list to keep track of the order of items in the cache

  • Use a hash map to store the key-value pairs for fast access

  • When an item is accessed, move it to the front of the linked list

  • When the cache is full, remove the least recently used item from the back of the linked list and the hash ...

Software Engineer Interview Questions Asked at Other Companies

asked in Qualcomm
Q1. Four people need to cross a bridge at night with only one torch t ... read more
asked in Capgemini
Q2. In a dark room, there is a box of 18 white and 5 black gloves. Yo ... read more
Q3. Tell me something about yourself. Define encapsulation. What is i ... read more
asked in Paytm
Q4. Puzzle : 100 people are standing in a circle .each one is allowed ... read more
asked in TCS
Q5. Find the Duplicate Number Problem Statement Given an integer arra ... read more
A Software Engineer was asked
Q. Given a number of time slots with start and end times, find a specific time with the maximum number of overlaps. Explain your solution.
Ans. 

Given time slots, find a specific time with maximum overlap. Prove solution.

  • Create a list of all start and end times

  • Sort the list in ascending order

  • Iterate through the list and keep track of the number of overlaps at each time

  • Return the time with the maximum number of overlaps

  • Prove solution by testing with different input sizes and edge cases

A Software Engineer was asked
Q. Given a stream of incoming integers that cannot all be stored in memory, how would you print the largest K numbers at the end of the input?
Ans. 

Use a min-heap to keep track of the largest K numbers seen so far.

  • Create a min-heap of size K.

  • For each incoming integer, add it to the heap if it's larger than the smallest element in the heap.

  • If the heap size exceeds K, remove the smallest element.

  • At the end, the heap will contain the largest K numbers in the input.

A Software Engineer was asked
Q. Given a sorted array that has been rotated, write the code to find a given integer.
Ans. 

Code to find a given integer in a rotated sorted array.

  • Use binary search to find the pivot point where the array is rotated.

  • Divide the array into two subarrays and perform binary search on the appropriate subarray.

  • Handle edge cases such as the target integer not being present in the array.

A Software Engineer was asked
Q. Given an array of integers, find the longest sub-array whose elements are in increasing order.
Ans. 

Find the longest sub-array with increasing order of integers.

  • Iterate through the array and keep track of the current sub-array's start and end indices.

  • Update the start index whenever the current element is smaller than the previous element.

  • Update the end index whenever the current element is greater than or equal to the next element.

  • Calculate the length of the sub-array and compare it with the longest sub-array fo...

A Software Engineer was asked
Q. Given two “ids” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of mutual friends
Ans. 

Function to return mutual friends given two ids and getFriends(id) function

  • Call getFriends(id) for both ids to get their respective friend lists

  • Iterate through both lists and compare to find mutual friends

  • Return the list of mutual friends

Are these interview questions helpful?
A Software Engineer was asked
Q. Given an “id” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of “friends of friends” in the order of decreasing number of mutual friends, ...
Ans. 

Function to return list of friends of friends in decreasing order of mutual friends

  • Use a set to store all friends of friends

  • Iterate through the list of friends of the given id

  • For each friend, iterate through their list of friends and count mutual friends

  • Sort the set of friends of friends by decreasing number of mutual friends

Facebook Software Engineer Interview Experiences

6 interviews found

Interview experience
5
Excellent
Difficulty level
-
Process Duration
-
Result
-
Round 1 - HR 

(1 Question)

  • Q1. Tell me about yourself
Interview experience
3
Average
Difficulty level
Hard
Process Duration
2-4 weeks
Result
-

I applied via Recruitment Consulltant and was interviewed in Apr 2023. There were 3 interview rounds.

Round 1 - Resume Shortlist 
Pro Tip by AmbitionBox:
Don’t add your photo or details such as gender, age, and address in your resume. These details do not add any value.
View all tips
Round 2 - Coding Test 

Leetcode question on DFS and BFS. Passed

Round 3 - Case Study 

Develop a ml model to predict pass/no pass decision.

Interview Preparation Tips

Interview preparation tips for other job seekers - case study needs to be well organized and you need to write down everything.

Interview Preparation Tips

Round: Test
Tips: Just try coding as much as you can in the four years of graduation.

Round: Interview
Experience: Three Coding Interview and a Behavioral Interview were conducted.
Tips: Try to get some prior knowledge about the company's infrastructure.w

General Tips: Practice as much problems as you can online or offline.
Skill Tips: Coding is the key for any software company.
Skills: Coding
College Name: IIT KHARAGPUR
Motivation: Its the best in business

Software Engineer Interview Questions & Answers

user image Deepali Adlakha

posted on 16 Mar 2015

Interview Questionnaire 

3 Questions

  • Q1. Some question on KMP
  • Q2. Simulation Question
  • Q3. Topological Sort Question

Interview Preparation Tips

Round: Test
Experience: Simple
Tips: Online Coding Questions
Duration: 60 minutes

Round: Technical Interview
Experience: Moderately difficult
Tips: Thorough understanding of all the algorithms is required.

Round: Technical Interview
Experience: Easy
Tips: Need to start a question afresh without attacking it the way you have solved questions in the past

Round: Technical Interview
Experience: Easy/moderately difficult
Tips: The idea was not that easy to click.

Skills: Coding
College Name: IIT BOMBAY
Motivation: Facebook has revolutionised social networking.

Interview Preparation Tips

Round: Resume Shortlist
Experience: You need to submit your CV and they shortlist you on this basis.Fast and accurate coding.
Tips: Clearly specify any technical achievement.

Round: Coding
Experience: You are given 4 hours to solve a few algorithmic questions.Start practicing for this from sometime earlier.
Tips: There are puzzles available on the Facebook page.

Round: Technical Interview
Experience: Three interviews. All almost exclusively technical with 1-2 HR questions.
The questions are mainly algorithmic in nature and you need to code online while talking to them.
Tips: Be as accurate and clean with your code as possible.

General Tips: Be creative while answering the questions. They might ask you questions like 'What changes would you want to make to Facebook?'.
Prepare algorithmic questions for the interviews. Most companies like Facebook, Google, Microsoft and others focus on this.
Technical projects or internships will be beneficial.
Qualifying for or winning programming contests like overnite is very beneficial. Involvement in Social/Cultural activities or sports is not really essential.
Skill Tips: Being good at writing fast and correct code in any language helps a lot.
Skills: Programming
College Name: IIT KHARAGPUR

Interview Questionnaire 

8 Questions

  • Q1. Given two “ids” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of mutual friends
  • Ans. 

    Function to return mutual friends given two ids and getFriends(id) function

    • Call getFriends(id) for both ids to get their respective friend lists

    • Iterate through both lists and compare to find mutual friends

    • Return the list of mutual friends

  • Answered by AI
  • Q2. Given an “id” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of “friends of friends” in the order of decreasing number of mutual friends,...
  • Ans. 

    Function to return list of friends of friends in decreasing order of mutual friends

    • Use a set to store all friends of friends

    • Iterate through the list of friends of the given id

    • For each friend, iterate through their list of friends and count mutual friends

    • Sort the set of friends of friends by decreasing number of mutual friends

  • Answered by AI
  • Q3. Given a number of time slots – start time and end time,“a b”, find any specific time with the maximum number of overlapping. After solving the problem I had to prove my solution
  • Ans. 

    Given time slots, find a specific time with maximum overlap. Prove solution.

    • Create a list of all start and end times

    • Sort the list in ascending order

    • Iterate through the list and keep track of the number of overlaps at each time

    • Return the time with the maximum number of overlaps

    • Prove solution by testing with different input sizes and edge cases

  • Answered by AI
  • Q4. Given an array of Integers, find the Longest sub-array whose elements are in Increasing Order
  • Ans. 

    Find the longest sub-array with increasing order of integers.

    • Iterate through the array and keep track of the current sub-array's start and end indices.

    • Update the start index whenever the current element is smaller than the previous element.

    • Update the end index whenever the current element is greater than or equal to the next element.

    • Calculate the length of the sub-array and compare it with the longest sub-array found s...

  • Answered by AI
  • Q5. Given an array of Integers, find the length of Longest Increasing Subsequence and print the sequence.
  • Ans. 

    Find the length of longest increasing subsequence and print the sequence from an array of integers.

    • Use dynamic programming to solve the problem

    • Create an array to store the length of longest increasing subsequence ending at each index

    • Traverse the array and update the length of longest increasing subsequence for each index

    • Print the sequence by backtracking from the index with the maximum length

    • Time complexity: O(n^2)

    • Exam...

  • Answered by AI
  • Q6. Given a Sorted Array which has been rotated, write the code to find a given Integer
  • Ans. 

    Code to find a given integer in a rotated sorted array.

    • Use binary search to find the pivot point where the array is rotated.

    • Divide the array into two subarrays and perform binary search on the appropriate subarray.

    • Handle edge cases such as the target integer not being present in the array.

  • Answered by AI
  • Q7. You have a number of incoming Integers, all of which cannot be stored into memory. We need to print largest K numbers at the end of input
  • Ans. 

    Use a min-heap to keep track of the largest K numbers seen so far.

    • Create a min-heap of size K.

    • For each incoming integer, add it to the heap if it's larger than the smallest element in the heap.

    • If the heap size exceeds K, remove the smallest element.

    • At the end, the heap will contain the largest K numbers in the input.

  • Answered by AI
  • Q8. Implement LRU Cache
  • Ans. 

    LRU Cache is a data structure that stores the most recently used items and discards the least recently used items.

    • Use a doubly linked list to keep track of the order of items in the cache

    • Use a hash map to store the key-value pairs for fast access

    • When an item is accessed, move it to the front of the linked list

    • When the cache is full, remove the least recently used item from the back of the linked list and the hash map

  • Answered by AI

Interview Preparation Tips

Round: ONLINE CODING ROUND
Experience: Facebook visited our campus in July, 2012. We had an online coding round hosted on InterviewStreet. We were asked to solve just one problem. The given problem boils down to : Given a undirected graph, source and destination, write the code to find the total number of distinct nodes visited, considering all possible paths.
Tips: Those shortlisted had to fly to Delhi for a Personal Interview. There were four rounds of interview, each of 45 minutes. The questions were simple. But just solving the given problem wasn't enough.

There was much more interaction and short questions asked related to the problem

Round: Technical Interview
Experience: The above mentioned questions wer asked in the interview. For every solution I was asked to write the code on paper. The code should also include the implementation of the data structures used (I used heaps - so I was asked to implement heaps ). They are looking for someone with good problem solving skills and conceptually sound in data structures

College Name: BIT MESRA

Skills evaluated in this interview

Top trending discussions

View All
Salary Discussions, Hike & Promotions
2w
a senior executive
GF salary Vs. My salary
Me and my gf have been dating for 5 years. Back in 2020, I started my career with a package of ₹5 LPA. Over the years, I’ve reached ₹22 LPA in 2025. She started her journey with ₹3 LPA(2020) and is now earning ₹8 LPA(2025). We’ve been in a live-in relationship for around 2 years, and the idea was to share expenses equally. But, equal sharing never really happened. If we go to a café she likes, especially with friends, I will pay the entire bill. We only split the house rent and grocery bills. I told her lots of time to cut down these costly cafe expenses or earn more money, increase your package, study and work hard, but.....she is now in her comfort zone. Being from a tech background, I have seen people upgrade their skills and package for a good life in metro cities. I am ready to support her in her studies, but she is like I am earning enough for myself.... No, you are not. I love her, but I don't know how to overcome this issue between us. Please suggest!
Got a question about Facebook?
Ask anonymously on communities.

Interview questions from similar companies

Interview Preparation Tips

Round: Test
Experience: First round was a simple round which involved 10 multiple choice questions and 3 coding questions on hackerrank platform.

Round: Technical Interview
Experience: Mainly on topics like networks, data structures and algorithms, operating systems. The interviewers looked for people who have had prior experience in web development and asked questions regarding web development in depth too.
Tips: I recommend everyone to read the book titled, 'Cracking the Coding Interview' as it was helpful in my approach to an interview.

General Tips: The one major thing that would give you the edge in joining Myntra would definitely be exposure to web development. Since it is not a part of the curriculum , it's all the more important for you to familiarize yourself with web development. In fact, a few projects in the same field would put you in a very advantageous position to get the job.
Skill Tips: 1. Start your placement preparations well ahead, no point regretting later.
2. Keep a concise resume. Do not take your resume to several pages.
3. Do not neglect aptitude preparation. Many people do this mistake and end up not clearing the first round for several companies.
4. Be thorough with your basics across all subjects. (Do not neglect any subject, even they you may like a few and dislike the others.)
5. Keep in mind, the interviewers are really friendly and try to make sure that you're not nervous during the interview. All they want to do is to test you. Be confident and give it your best shot.
Skills:
College Name: NIT Surathkal
Are these interview questions helpful?
Interview experience
2
Poor
Difficulty level
Moderate
Process Duration
Less than 2 weeks
Result
Selected Selected

I applied via Company Website and was interviewed in Aug 2023. There were 3 interview rounds.

Round 1 - Resume Shortlist 
Pro Tip by AmbitionBox:
Keep your resume crisp and to the point. A recruiter looks at your resume for an average of 6 seconds, make sure to leave the best impression.
View all tips
Round 2 - Coding Test 

I'm knowlege of c language

Round 3 - One-on-one 

(2 Questions)

  • Q1. Aney question of c language
  • Q2. And data base and etc

Interview Preparation Tips

Interview preparation tips for other job seekers - I'm knowlege of knowledge management and computer networks
Interview experience
4
Good
Difficulty level
Hard
Process Duration
Less than 2 weeks
Result
Not Selected

I applied via Company Website and was interviewed in Nov 2024. There was 1 interview round.

Round 1 - Coding Test 

1. PEAK ELEMENT QUESTION.
2. COIN DENOMINATION

Interview experience
5
Excellent
Difficulty level
-
Process Duration
-
Result
-
Round 1 - Coding Test 

Lists and Trees were asked

Facebook Interview FAQs

How many rounds are there in Facebook Software Engineer interview?
Facebook interview process usually has 2 rounds. The most common rounds in the Facebook interview process are Resume Shortlist, Coding Test and Case Study.
How to prepare for Facebook Software Engineer interview?
Go through your CV in detail and study all the technologies mentioned in your CV. Prepare at least two technologies or languages in depth if you are appearing for a technical interview at Facebook. The most common topics and skills that interviewers at Facebook expect are Computer Networking, C++, Ethernet, FPGA and Firmware.
What are the top questions asked in Facebook Software Engineer interview?

Some of the top questions asked at the Facebook Software Engineer interview -

  1. Given an “id” and a function getFriends(id) to get the list of friends of t...read more
  2. Given two “ids” and a function getFriends(id) to get the list of friends of...read more
  3. Given a number of time slots – start time and end time,“a b”, find any sp...read more

Tell us how to improve this page.

Overall Interview Experience Rating

4.6/5

based on 5 interview experiences

Difficulty level

Easy 50%
Hard 50%

Duration

Less than 2 weeks 50%
2-4 weeks 50%
View more
Facebook Software Engineer Salary
based on 87 salaries
₹84.9 L/yr - ₹1.2 Cr/yr
1000% more than the average Software Engineer Salary in India
View more details

Facebook Software Engineer Reviews and Ratings

based on 16 reviews

4.6/5

Rating in categories

4.7

Skill development

4.3

Work-life balance

4.5

Salary

4.4

Job security

4.9

Company culture

4.4

Promotions

4.7

Work satisfaction

Explore 16 Reviews and Ratings
Software Engineer, Product

Bangalore / Bengaluru

2-6 Yrs

Not Disclosed

Software Engineer, Product

Bangalore / Bengaluru

2-6 Yrs

Not Disclosed

Software Engineer - Host Networking

Bangalore / Bengaluru

2-7 Yrs

Not Disclosed

Explore more jobs
Software Engineer
87 salaries
unlock blur

₹84.9 L/yr - ₹120 L/yr

Software Developer
25 salaries
unlock blur

₹35.3 L/yr - ₹36.3 L/yr

Data Scientist
21 salaries
unlock blur

₹66.6 L/yr - ₹130.5 L/yr

Senior Software Engineer
19 salaries
unlock blur

₹15 L/yr - ₹44.5 L/yr

Program Manager
15 salaries
unlock blur

₹20 L/yr - ₹65 L/yr

Explore more salaries
Compare Facebook with

Google

4.4
Compare

Amazon

4.0
Compare

Apple

4.3
Compare

eBay

4.0
Compare
write
Share an Interview