Upload Button Icon Add office photos

Facebook

Compare button icon Compare button icon Compare

Filter interviews by

Facebook Software Developer Interview Questions and Answers for Freshers

Updated 30 Oct 2024

8 Interview questions

A Software Developer was asked
Q. 

Search In Rotated Sorted Array Problem Statement

Given a rotated sorted array ARR of size 'N' and an integer 'K', determine the index at which 'K' is present in the array.

Note:
1. If 'K' is not present ...
Ans. 

Given a rotated sorted array, find the index of a given integer 'K'.

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

  • Then perform binary search on the appropriate half of the array to find 'K'.

  • Handle cases where 'K' is not present in the array by returning -1.

A Software Developer was asked
Q. 

Rank from Stream Problem Statement

Given an array of integers ARR and an integer K, determine the rank of the element ARR[K].

Explanation:

The rank of any element in ARR is defined as the number of eleme...

Ans. 

Given an array and an index, find the number of elements smaller than the element at that index appearing before it in the array.

  • Iterate through the array up to index K and count the number of elements smaller than ARR[K].

  • Return the count as the rank of ARR[K].

  • Handle edge cases like empty array or invalid index K.

Software Developer Interview Questions Asked at Other Companies for Fresher

asked in Amazon
Q1. Maximum Subarray Sum Problem Statement Given an array of integers ... read more
asked in Nagarro
Q2. Crazy Numbers Pattern Challenge Ninja enjoys arranging numbers in ... read more
asked in Mr Cooper
Q3. Connect Ropes Problem Statement Given a number of ropes denoted a ... read more
asked in TCS
Q4. Palindromic Numbers Finder Given an integer 'N', your task is to ... read more
Q5. Validate Binary Tree Nodes Problem You are provided with 'N' bina ... read more
A Software Developer was asked
Q. 

LRU Cache Design Question

Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:

1. get(key) - Return the value of the key if it exists in the cache; otherwi...

Ans. 

Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.

  • Implement a doubly linked list to maintain the order of recently used keys.

  • Use a hashmap to store key-value pairs for quick access.

  • Update the order of keys in the linked list on get and put operations.

  • Evict the least recently used key when the cache reaches its capacity.

A Software Developer was asked
Q. 

Merge Intervals Problem Statement

You are provided with 'N' intervals, each containing two integers denoting the start time and end time of the interval.

Your task is to merge all overlapping intervals an...

Ans. 

Merge overlapping intervals and return sorted list of merged intervals.

  • Sort the intervals based on start times.

  • Iterate through intervals and merge overlapping intervals.

  • Return the merged intervals in sorted order.

A Software Developer was asked
Q. 

Path Counting in Directed Graph

Given a directed graph with a specified number of vertices V and edges E, your task is to calculate the total number of distinct paths from a given source node S to all oth...

Ans. 

Calculate the total number of distinct paths from a given source node to all other nodes in a directed graph.

  • Use dynamic programming to keep track of the number of paths from the source node to each node in the graph.

  • Consider using modular arithmetic to handle large numbers and prevent overflow.

  • Start by initializing the number of paths from the source node to itself as 1.

  • Iterate through the edges of the graph and ...

A Software Developer was asked
Q. 

Longest Increasing Subsequence Problem Statement

Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This ...

Ans. 

Find the length of the longest strictly increasing subsequence in an array of integers.

  • Use dynamic programming to solve this problem efficiently.

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

  • Iterate through the array and update the length of the longest increasing subsequence for each element.

  • Return the maximum value in the array as the result.

A Software Developer was asked
Q. 

Course Schedule II Problem Statement

You are provided with a number of courses 'N', some of which have prerequisites. There is a matrix named 'PREREQUISITES' of size 'M' x 2. This matrix indicates that for...

Ans. 

Given courses with prerequisites, determine a valid order to complete all courses.

  • Use topological sorting to find a valid order of courses.

  • Create a graph with courses as nodes and prerequisites as edges.

  • Start with courses that have no prerequisites and remove them from the graph.

  • Continue this process until all courses are taken or there are no valid courses left.

  • If there is a cycle in the graph, it is impossible t...

Are these interview questions helpful?
A Software Developer was asked
Q. 

Longest Route Problem Statement

Given a 2-dimensional binary matrix called Mat of size N x M that consists solely of 0s and 1s, find the length of the longest path from a specified source cell to a destinat...

Ans. 

Find the length of the longest path from a source cell to a destination cell in a binary matrix.

  • Use depth-first search (DFS) to explore all possible paths from source to destination.

  • Keep track of visited cells to avoid revisiting them.

  • Return the length of the longest path found, or -1 if no path exists.

Facebook Software Developer Interview Experiences for Freshers

2 interviews found

Interview experience
5
Excellent
Difficulty level
Moderate
Process Duration
2-4 weeks
Result
No response

I applied via LinkedIn and was interviewed in Jul 2024. There was 1 interview round.

Round 1 - HR 

(2 Questions)

  • Q1. Why you want to join facebook?
  • Ans. 

    I want to join Facebook because of its innovative technology, global impact, and opportunities for growth.

    • Innovative technology: Facebook is known for its cutting-edge technology and constant innovation.

    • Global impact: Working at Facebook would allow me to contribute to a platform that connects billions of people worldwide.

    • Opportunities for growth: Facebook offers a dynamic and fast-paced work environment with ample opp...

  • Answered by AI
  • Q2. Whats the best feature you like in Facebook?
  • Ans. 

    I appreciate the personalized news feed feature on Facebook.

    • Personalized news feed shows content based on user interests

    • Helps users stay updated on relevant information

    • Allows users to engage with content they are interested in

  • Answered by AI

I appeared for an interview before Dec 2020.

Round 1 - Coding Test 

(2 Questions)

Round duration - 90 minutes
Round difficulty - Hard

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.

  • Q1. 

    Path Counting in Directed Graph

    Given a directed graph with a specified number of vertices V and edges E, your task is to calculate the total number of distinct paths from a given source node S to all ot...

  • Ans. 

    Calculate the total number of distinct paths from a given source node to all other nodes in a directed graph.

    • Use dynamic programming to keep track of the number of paths from the source node to each node in the graph.

    • Consider using modular arithmetic to handle large numbers and prevent overflow.

    • Start by initializing the number of paths from the source node to itself as 1.

    • Iterate through the edges of the graph and updat...

  • Answered by AI
  • Q2. 

    Course Schedule II Problem Statement

    You are provided with a number of courses 'N', some of which have prerequisites. There is a matrix named 'PREREQUISITES' of size 'M' x 2. This matrix indicates that fo...

  • Ans. 

    Given courses with prerequisites, determine a valid order to complete all courses.

    • Use topological sorting to find a valid order of courses.

    • Create a graph with courses as nodes and prerequisites as edges.

    • Start with courses that have no prerequisites and remove them from the graph.

    • Continue this process until all courses are taken or there are no valid courses left.

    • If there is a cycle in the graph, it is impossible to com...

  • Answered by AI
Round 2 - Face to Face 

(2 Questions)

Round duration - 60 Minutes
Round difficulty - Medium

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 .

  • Q1. 

    Merge Intervals Problem Statement

    You are provided with 'N' intervals, each containing two integers denoting the start time and end time of the interval.

    Your task is to merge all overlapping intervals a...

  • Ans. 

    Merge overlapping intervals and return sorted list of merged intervals.

    • Sort the intervals based on start times.

    • Iterate through intervals and merge overlapping intervals.

    • Return the merged intervals in sorted order.

  • Answered by AI
  • Q2. 

    Longest Route Problem Statement

    Given a 2-dimensional binary matrix called Mat of size N x M that consists solely of 0s and 1s, find the length of the longest path from a specified source cell to a destina...

  • Ans. 

    Find the length of the longest path from a source cell to a destination cell in a binary matrix.

    • Use depth-first search (DFS) to explore all possible paths from source to destination.

    • Keep track of visited cells to avoid revisiting them.

    • Return the length of the longest path found, or -1 if no path exists.

  • Answered by AI
Round 3 - Face to Face 

(2 Questions)

Round duration - 50 Minutes
Round difficulty - Medium

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 .

  • Q1. 

    Longest Increasing Subsequence Problem Statement

    Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This...

  • Ans. 

    Find the length of the longest strictly increasing subsequence in an array of integers.

    • Use dynamic programming to solve this problem efficiently.

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

    • Iterate through the array and update the length of the longest increasing subsequence for each element.

    • Return the maximum value in the array as the result.

  • Answered by AI
  • Q2. 

    Search In Rotated Sorted Array Problem Statement

    Given a rotated sorted array ARR of size 'N' and an integer 'K', determine the index at which 'K' is present in the array.

    Note:
    1. If 'K' is not present...
  • Ans. 

    Given a rotated sorted array, find the index of a given integer 'K'.

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

    • Then perform binary search on the appropriate half of the array to find 'K'.

    • Handle cases where 'K' is not present in the array by returning -1.

  • Answered by AI
Round 4 - Face to Face 

(2 Questions)

Round duration - 50 Minutes
Round difficulty - Medium

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 .

  • Q1. 

    Rank from Stream Problem Statement

    Given an array of integers ARR and an integer K, determine the rank of the element ARR[K].

    Explanation:

    The rank of any element in ARR is defined as the number of elem...

  • Ans. 

    Given an array and an index, find the number of elements smaller than the element at that index appearing before it in the array.

    • Iterate through the array up to index K and count the number of elements smaller than ARR[K].

    • Return the count as the rank of ARR[K].

    • Handle edge cases like empty array or invalid index K.

  • Answered by AI
  • Q2. 

    LRU Cache Design Question

    Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:

    1. get(key) - Return the value of the key if it exists in the cache; otherw...

  • Ans. 

    Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.

    • Implement a doubly linked list to maintain the order of recently used keys.

    • Use a hashmap to store key-value pairs for quick access.

    • Update the order of keys in the linked list on get and put operations.

    • Evict the least recently used key when the cache reaches its capacity.

  • Answered by AI

Interview Preparation Tips

Eligibility criteriaAbove 7 CGPAFacebook interview preparation:Topics to prepare for the interview - Data Structures, Algorithms, System Design, Aptitude, OOPSTime required to prepare for the interview - 4 MonthsInterview preparation tips for other job seekers

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 resume tips for other job seekers

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.

Final outcome of the interviewSelected

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

I appeared for an interview before Jun 2021.

Round 1 - Coding Test 

(2 Questions)

Round duration - 120 minutes
Round difficulty - Medium

  • Q1. 

    Find All Pairs Adding Up to Target

    Given an array of integers ARR of length N and an integer Target, your task is to return all pairs of elements such that they add up to the Target.

    Input:

    The first line ...
  • Ans. 

    Given an array of integers and a target, find all pairs of elements that add up to the target.

    • Iterate through the array and for each element, check if the target minus the element exists in a hash set.

    • If it exists, add the pair to the result. If not, add the element to the hash set.

    • Handle cases where the same element is used twice in a pair.

    • Return (-1, -1) if no pair is found.

  • Answered by AI
  • Q2. 

    Clone a Linked List with Random Pointers

    Given a linked list where each node contains two pointers: one pointing to the next node and another random pointer that can point to any node within the list (or ...

  • Ans. 

    Create a deep copy of a linked list with random pointers.

    • Iterate through the original linked list and create a new node for each node in the list.

    • Store the mapping of original nodes to new nodes in a hashmap to handle random pointers.

    • Update the random pointers of new nodes based on the mapping stored in the hashmap.

    • Return the head of the copied linked list.

  • Answered by AI
Round 2 - Video Call 

(2 Questions)

Round duration - 60 Minutes
Round difficulty - Medium

  • Q1. 

    Unique Element in Array

    Given an arbitrary array arr consisting of N non-negative integers where every element appears thrice except for one. Your task is to find the element in the array that appears onl...

  • Ans. 

    Find the element that appears only once in an array where every other element appears thrice.

    • Use bitwise operations like XOR to find the unique element in linear time complexity.

    • XOR all elements in the array, the result will be the unique element.

    • Elements that appear thrice will cancel out each other in XOR operation.

    • Example: arr = [2, 2, 3, 2], XOR of all elements = 3 which is the unique element.

  • Answered by AI
  • Q2. 

    Next Greater Element Problem Statement

    You are provided with an array or list ARR containing N positive integers. Your task is to determine the Next Greater Element (NGE) for each element in the array.

    T...

  • Ans. 

    Find the Next Greater Element for each element in an array.

    • Iterate through the array from right to left

    • Use a stack to keep track of elements with no greater element to the right

    • Pop elements from the stack until a greater element is found or stack is empty

  • Answered by AI
Round 3 - Video Call 

(2 Questions)

Round duration - 60 Minutes
Round difficulty - Medium

  • Q1. 

    Convert BST to Greater Sum Tree

    Given a Binary Search Tree (BST) of integers, your task is to convert it into a greater sum tree. In the greater sum tree, each node's value should be replaced with the sum...

  • Ans. 

    Convert a Binary Search Tree into a Greater Sum Tree by replacing each node's value with the sum of all nodes' values greater than the current node's value.

    • Traverse the BST in reverse inorder (right, root, left) to visit nodes in descending order.

    • Keep track of the running sum of visited nodes' values and update each node's value with this sum.

    • Recursively apply the above steps to all nodes in the BST.

    • Example: For input ...

  • Answered by AI
  • Q2. 

    Sort Linked List Problem Statement

    You are given a linked list of N nodes where each node contains values 0, 1, and 2 exclusively. Your task is to sort the linked list.

    Input:

    The first line contains an...
  • Ans. 

    Sort a linked list containing values 0, 1, and 2 exclusively.

    • Use three pointers to keep track of nodes with values 0, 1, and 2 separately.

    • Traverse the linked list and move nodes to their respective positions based on their values.

    • Finally, concatenate the three lists in the order 0 -> 1 -> 2 to get the sorted linked list.

  • Answered by AI
Round 4 - Video Call 

(2 Questions)

Round duration - 45 minutes
Round difficulty - Medium

  • Q1. 

    Number of Islands Problem Statement

    You are provided with a 2-dimensional matrix having N rows and M columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in t...

  • Ans. 

    Count the number of islands in a 2D matrix of 1s and 0s.

    • Use Depth First Search (DFS) or Breadth First Search (BFS) to traverse the matrix and identify connected groups of 1s.

    • Maintain a visited array to keep track of visited cells to avoid redundant traversal.

    • Increment the island count each time a new island is encountered.

    • Consider edge cases like when the matrix is empty or when all cells are water (0s).

  • Answered by AI
  • Q2. 

    Maximum Path Sum in a Matrix

    Given an N*M matrix filled with integer numbers, determine the maximum sum that can be obtained from a path starting from any cell in the first row to any cell in the last row...

  • Ans. 

    Find the maximum sum that can be obtained from a path in a matrix from the first row to the last row.

    • Use dynamic programming to keep track of the maximum sum at each cell.

    • Consider moving down, down-left, and down-right to calculate the maximum sum.

    • Start from the second row and update the values based on the maximum sum from the row above.

    • At the end, find the maximum sum in the last row to get the final result.

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI applied for the job as SDE - 1 in HyderabadEligibility criteria> 7 CGPAAmazon interview preparation:Topics to prepare for the interview - Data Structures, OOPS, Algorithms, OS, Networks, GraphsTime required to prepare for the interview - 3 MonthsInterview preparation tips for other job seekers

Tip 1 - Practice variety of questions
Tip 2 - Do atleast 2 projects

Application resume tips for other job seekers

Tip 1 : Do good projects
Tip 2 : resume should be one page

Final outcome of the interviewSelected

Skills evaluated in this interview

I appeared for an interview before Sep 2020.

Round 1 - Coding Test 

Round duration - 90 minutes
Round difficulty - Easy

This round was held during university hours and consisted of 2 coding questions.

Round 2 - Face to Face 

(1 Question)

Round duration - 120 minutes
Round difficulty - Easy

Make sure you do no cutting and are clear about the approach you'd be following. 
 

  • Q1. What is the running median of an input stream?
  • Ans. 

    Running median of an input stream is the median value of the numbers seen so far in a continuous stream of data.

    • Maintain two heaps - a max heap for the lower half of the numbers and a min heap for the upper half.

    • Keep the number of elements in the two heaps balanced or differ by at most 1.

    • If the total number of elements is odd, the median is the root of the max heap. If even, it is the average of the roots of the two he...

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI completed Electronics & Communication Engineering from TIET - Thapar Institute of Engineering And Technology. I applied for the job as SDE - 1 in HyderabadEligibility criteria 7 CGPA Amazon interview preparation:Topics to prepare for the interview - Data Structures and Algorithms, Java, Object-Oriented Programming System, System Design, Operating System.Time required to prepare for the interview - 2 MonthsInterview preparation tips for other job seekers

Prepare for company-wise interview questions according to the company in which you are applying. Try to write the code yourself and if got stuck in between then take help from the internet. I recommend you Codezen of Coding Ninjas for practicing Data Structures and Algorithms based questions.

Application resume tips for other job seekers

Be sure 100% of what you write in your resume and prepare for that before the interview what is written on resume.

Final outcome of the interviewSelected

Skills evaluated in this interview

I appeared for an interview before Sep 2020.

Round 1 - Coding Test 

(2 Questions)

Round duration - 90 Miinutes
Round difficulty - Medium

First round had MCQ + 2 coding questions. It was held in morning around 11 am. It was held on campus.

  • Q1. 

    Robot Delivery Path Problem

    You are tasked with directing a robot from the top-left corner of an N*N matrix to a specified point (x, y), delivering a parcel. The robot is restricted to move only on flat a...

  • Ans. 

    Determine if a robot can reach a specified destination in a matrix by moving only downwards or rightwards.

    • Start at (0,0) and move towards the destination (x, y) only downwards or rightwards.

    • Check if the path is clear (1) and avoid obstacles (0) while staying within matrix boundaries.

    • Return true if the robot can reach the destination, false otherwise.

    • Example: For input matrix [[1, 0, 1], [1, 1, 1], [1, 1, 5]] with desti...

  • Answered by AI
  • Q2. 

    Unique Element in Array

    Given an arbitrary array arr consisting of N non-negative integers where every element appears thrice except for one. Your task is to find the element in the array that appears onl...

  • Ans. 

    Find the unique element in an array where every element appears thrice except for one.

    • Use XOR operation to find the unique element.

    • Iterate through the array and XOR each element to find the unique element.

    • The XOR operation cancels out elements that appear thrice, leaving only the unique element.

    • Example: arr = [2, 2, 3, 2], XOR of all elements = 3.

    • Example: arr = [0, 1, 0, 1, 0, 1, 99], XOR of all elements = 99.

  • Answered by AI
Round 2 - Face to Face 

(2 Questions)

Round duration - 90 Minutes
Round difficulty - Medium

Second Round was held in morning around 10-11 am. There was one interviewer working on his laptop. Interviewer was really helpful and first offered me water and then for a bit talked about himself.

  • Q1. 

    BST Iterator Problem Statement

    You are tasked with implementing a class BSTIterator, which is designed to traverse a Binary Search Tree (BST) in the inorder manner. The class must support the following op...

  • Ans. 

    Implement a BSTIterator class to traverse a Binary Search Tree in inorder manner.

    • Implement a constructor to initialize the iterator with the root of the BST.

    • Implement next() and hasNext() methods to traverse the BST in inorder.

    • Implement prev() and hasPrev() methods to access the previous element in the inorder traversal.

    • Use level-order traversal format to represent the tree input.

    • Output the inorder traversal of the bin...

  • Answered by AI
  • Q2. 

    Distance Between Two Nodes in a Binary Tree

    Given a binary tree and the values of two distinct nodes, determine the distance between these two nodes in the tree. The distance is defined as the minimum num...

  • Ans. 

    Calculate the distance between two nodes in a binary tree.

    • Traverse the tree to find the paths from the root to each node

    • Find the lowest common ancestor of the two nodes

    • Calculate the distance by adding the distances from the LCA to each node

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI completed Computer Science Engineering from Dr. B.R. Ambedkar National Institute of Technology. I applied for the job as SDE - 1 in HyderabadEligibility criteriaNo criteriaAmazon interview preparation:Topics to prepare for the interview - Array,Linked List, Trees, Dynamic Programming, Graphs, Math, OOPSTime required to prepare for the interview - 4 MonthsInterview preparation tips for other job seekers

Tip 1 : Keep talking about what are you thinking
Tip 2 : Don't beat about the bush if don't know the answer just say so
 

Application resume tips for other job seekers

Tip 1 : Only show projects you are confident about
Tip 2 : Basic Web and android projects are also fine

Final outcome of the interviewSelected

Skills evaluated in this interview

Interview Questionnaire 

2 Questions

  • Q1. Who is the CEO of amazon?
  • Q2. Andy Jassy

I appeared for an interview before Dec 2020.

Round 1 - Coding Test 

(2 Questions)

Round duration - 90 Minutes
Round difficulty - Medium

2 coding questions and 20 mcq
 

  • Q1. 

    Rotting Oranges Problem Statement

    You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:

    • 0 - representing an empty cell
    • 1 - representing a fre...
  • Ans. 

    Find the minimum time required to rot all fresh oranges in a grid.

    • Use Breadth First Search (BFS) to simulate the rotting process.

    • Track the time taken to rot all oranges and return -1 if any fresh oranges remain.

    • Handle edge cases like no fresh oranges or all oranges already rotten.

    • Consider using a queue to efficiently process adjacent oranges.

    • Ensure to update the grid with the new state of oranges after each second.

  • Answered by AI
  • Q2. 

    Calculate Sum of Proper Divisors

    Given a natural number N, return the sum of all its proper divisors.

    A proper divisor of Y is defined as a number X such that X < Y and Y % X = 0.

    Example:

    Input:
    T...
  • Ans. 

    Calculate the sum of proper divisors of a given natural number.

    • Iterate from 1 to sqrt(N) and check for divisors

    • If a divisor is found, add it to the sum and also add N/divisor if it is not the same as divisor

    • Return the sum as the result

  • Answered by AI
Round 2 - Video Call 

(1 Question)

Round duration - 45 Minutes
Round difficulty - Medium

Technical interview

  • Q1. 

    Rearrange Array to Form Largest Number

    Given an array ARR consisting of non-negative integers, rearrange the numbers to form the largest possible number. The digits within each number cannot be changed.

    ...

  • Ans. 

    Rearrange the array elements to form the largest possible number by concatenating them.

    • Sort the array elements in a custom comparator function to get the largest number.

    • Convert the sorted array elements to strings and concatenate them to form the final number.

    • Handle cases where the numbers have the same prefix by comparing the concatenated forms.

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI applied for the job as SDE - 1 in DelhiEligibility criteriaCriteria not revealed to candidateAmazon interview preparation:Topics to prepare for the interview - Array, Linkedlist, Tree, Graph, Stack, OOPS, Geeksforgeeks archives, coding ninjas interview experience blogsTime required to prepare for the interview - 1 MonthInterview preparation tips for other job seekers

Tip 1 : Be clear about whatever you have mentioned in resume, don't mention buzz words, because interviewer can go in depth
Tip 2 : Along with DS and Algo, if you have 3-4 months experience or internship experience, then be ready to answer scenario based technical questions like scaling the application that you developed and design concepts that can be used for improving
Tip 3 : Last but most important tip is to be calm through out the whole process ,don't loose hope if any round didn't go well ,if you have explained your thought process there is still chance to procees to next round so keep preparating for next rounds.

Application resume tips for other job seekers

Tip 1 : Keep it one page resume and mention keywords which align with your technical and personal competencies.
Tip 2 : Mention 3-4 projects in the order that , project which you can explain best should be at top,then the next, and so on.

Final outcome of the interviewRejected

Skills evaluated in this interview

Are these interview questions helpful?

I appeared for an interview in Oct 2020.

Round 1 - Coding Test 

(2 Questions)

Round duration - 120 minutes
Round difficulty - Medium

Evening test around 5
Platform :- SHL
Environment was amazing

  • Q1. 

    Subtree of Another Tree Problem Statement

    Given two binary trees, T and S, determine whether S is a subtree of T. The tree S should have the same structure and node values as a subtree of T.

    Explanation:

    ...
  • Ans. 

    Given two binary trees T and S, determine if S is a subtree of T with the same structure and node values.

    • Check if the second tree is a subtree of the first tree by comparing their structures and node values.

    • Use a recursive approach to traverse both trees and check for equality.

    • Handle cases where one tree is null or the values do not match.

    • Return true if S is a subtree of T, false otherwise.

  • Answered by AI
  • Q2. 

    Search in a Row-wise and Column-wise Sorted Matrix Problem Statement

    You are given an N * N matrix of integers where each row and each column is sorted in increasing order. Your task is to find the positi...

  • Ans. 

    Given a sorted N*N matrix, find the position of a target integer X.

    • Iterate over each row and column to find the target integer X

    • Utilize the sorted nature of the matrix to optimize the search process

    • Return the position of X if found, else return -1 -1

  • Answered by AI
Round 2 - Video Call 

(2 Questions)

Round duration - 60 minutes
Round difficulty - Medium

1 Hour 
Afternoon

  • Q1. 

    Intersection of Linked List Problem

    You are provided with two singly linked lists containing integers, where both lists converge at some node belonging to a third linked list.

    Your task is to determine t...

  • Ans. 

    Find the node where two linked lists merge, return -1 if no merging occurs.

    • Traverse both lists to find their lengths and the difference in lengths

    • Move the pointer of the longer list by the difference in lengths

    • Traverse both lists simultaneously until they meet at the merging point

  • Answered by AI
  • Q2. 

    Problem: Pair Sum in a Binary Search Tree

    Given a Binary Search Tree (BST) and an integer 'S', your task is to find all pairs of nodes within the BST that total to 'S' and return these pairs. If no such p...

  • Ans. 

    Find pairs of nodes in a BST that sum up to a given value 'S'.

    • Traverse the BST in-order to get a sorted list of nodes.

    • Use two pointers approach to find pairs with sum 'S'.

    • Keep track of visited nodes to avoid using the same node twice in a pair.

  • Answered by AI
Round 3 - Video Call 

(2 Questions)

Round duration - 60 minutes
Round difficulty - Medium

Online Round held on Chime

  • Q1. 

    Is Binary Heap Tree Problem Statement

    You are given a binary tree of integers. Your task is to determine if it is a binary heap tree or not.

    Input:

    The first line of input contains an integer ‘T’ denoti...
  • Ans. 

    Determine if a given binary tree is a binary heap tree or not based on certain properties.

    • Check if the binary tree is a complete binary tree where every level, except the last level, is completely filled and the last level is as far left as possible.

    • Ensure that every parent node is greater than all its children nodes, forming a max-heap.

    • If any node does not have a left or right child, it should be represented as -1 in ...

  • Answered by AI
  • Q2. 

    Edit Distance Problem Statement

    Given two strings S and T with lengths N and M respectively, your task is to find the "Edit Distance" between these strings.

    The Edit Distance is defined as the minimum nu...

  • Ans. 

    The task is to find the minimum number of operations required to convert one string into another using delete, replace, and insert operations.

    • Use dynamic programming to solve the problem efficiently.

    • Create a 2D array to store the edit distances between substrings of the two input strings.

    • Fill up the array based on the minimum of three possible operations: insert, delete, or replace.

    • The final answer will be the value at...

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI applied for the job as SDE - 1 in BangaloreEligibility criteriaNo backlogsAmazon interview preparation:Topics to prepare for the interview - Data Structures, OOPS, OS, DBMS, Dynamic Programming, Trees/Graph, Tries, Hashing, Algorithms, HadoopTime required to prepare for the interview - 4.5 monthsInterview preparation tips for other job seekers

Tip 1 : 1 Programming Language
Tip 2 : Practice Data Structures with atleast 300 ques.
Tip 3 : CS Fundamental

Application resume tips for other job seekers

Tip 1 : 1 Pager
Tip 2 : Add top 3 projects in Resume.

Final outcome of the interviewSelected

Skills evaluated in this interview

I appeared for an interview before Sep 2020.

Round 1 - Coding Test 

(2 Questions)

Round duration - 90 minutes
Round difficulty - Medium

  • Q1. 

    String Transformation Problem Statement

    Given a string str of length N, perform a series of operations to create a new string:

    1. Select the smallest character from the first 'K' characters of the string,...
  • Ans. 

    The problem involves selecting the smallest character from the first 'K' characters of a string and appending it to a new string until the original string is empty.

    • Iterate through the string, selecting the smallest character from the first 'K' characters each time.

    • Remove the selected character from the original string and append it to the new string.

    • If fewer than 'K' characters remain, sort and append them in order.

    • Rep...

  • Answered by AI
  • Q2. 

    Counting Derangements Problem

    A derangement is a permutation of 'N' elements, where no element appears in its original position. For instance, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0} because each el...

  • Ans. 

    Count the total number of derangements possible for a set of 'N' elements.

    • A derangement is a permutation where no element appears in its original position.

    • Use the formula for derangements: !n = n! * (1 - 1/1! + 1/2! - 1/3! + ... + (-1)^n/n!).

    • Return the answer modulo (10^9 + 7) as the result could be very large.

  • Answered by AI
Round 2 - Video Call 

(4 Questions)

Round duration - 60 minutes
Round difficulty - Medium

1 hour online interview. 
Slot was given prior via email.
The HR contacted me via email and simultaneously provided me a link where I had to write the codes during my interview

  • Q1. 

    Mike and Mobile Keypad Problem

    Mike, a young math enthusiast, is playing with his mom’s mobile phone, which has a keypad with 12 buttons (10 digits: 0-9, and 2 special characters: ‘*’ and ‘#’). His challe...

  • Ans. 

    Calculate the number of distinct numbers that can be formed by pressing 'N' buttons on a mobile keypad following specific rules.

    • Use dynamic programming to keep track of the number of distinct numbers that can be formed at each step.

    • Consider the possible transitions from each button to calculate the total number of distinct numbers.

    • Implement a solution that efficiently handles large values by using modulo arithmetic.

    • Ens...

  • Answered by AI
  • Q2. 

    Maximum Subarray Sum Problem Statement

    Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array.

    Example:

    Input:
    array = [34, -50, 42, 14, -5, 86]
    Out...
  • Ans. 

    Find the maximum sum of any contiguous subarray within an array of integers.

    • Iterate through the array and keep track of the maximum sum of subarrays encountered so far.

    • At each index, decide whether to include the current element in the subarray or start a new subarray.

    • Use Kadane's algorithm to efficiently find the maximum subarray sum in O(N) time complexity.

  • Answered by AI
  • Q3. 

    Maximum Sum of Non-Adjacent Elements

    Given an array/list of ‘N’ integers, your task is to return the maximum sum of the subsequence where no two elements are adjacent in the given array/list.

    Example:

    I...
  • Ans. 

    Find the maximum sum of non-adjacent elements in an array.

    • Use dynamic programming to keep track of the maximum sum at each index, considering whether to include the current element or skip it.

    • At each index, the maximum sum is either the sum of the current element and the element two positions back, or the sum at the previous index.

    • Iterate through the array and update the maximum sum at each index accordingly.

    • Return the...

  • Answered by AI
  • Q4. 

    Trapping Rainwater Problem Statement

    You are given an array ARR of long type, which represents an elevation map where ARR[i] denotes the elevation of the ith bar. Calculate the total amount of rainwater t...

  • Ans. 

    Calculate the total amount of rainwater that can be trapped within given elevation map.

    • Iterate through the array to find the maximum height on the left and right of each bar.

    • Calculate the amount of water that can be trapped above each bar by taking the minimum of the maximum heights on the left and right.

    • Sum up the trapped water above each bar to get the total trapped water for the elevation map.

  • Answered by AI
Round 3 - Video Call 

(2 Questions)

Round duration - 60 minutes
Round difficulty - Medium

  • Q1. 

    Strongly Connected Components (Tarjan’s Algorithm) Problem Statement

    Given an unweighted directed graph with V vertices and E edges, your task is to identify and print all the strongly connected component...

  • Ans. 

    Tarjan's Algorithm is used to find strongly connected components in an unweighted directed graph.

    • Tarjan's Algorithm is a depth-first search based algorithm.

    • It uses a stack to keep track of vertices in the current SCC.

    • The algorithm assigns a unique id to each vertex and keeps track of the lowest id reachable from the current vertex.

    • Once a SCC is identified, the vertices in the stack form that SCC.

    • The algorithm runs in O...

  • Answered by AI
  • Q2. 

    Stock Trading Maximum Profit Problem

    Given the stock prices for 'N' days, your goal is to determine the maximum profit that can be achieved. You can buy and sell the stocks any number of times but can onl...

  • Ans. 

    The goal is to determine the maximum profit that can be achieved by buying and selling stocks on different days.

    • Iterate through the stock prices and buy on days when the price is lower than the next day, and sell on days when the price is higher than the next day.

    • Calculate the profit by summing up the differences between buying and selling prices.

    • Repeat the process for each test case and output the maximum profit achie...

  • Answered by AI
Round 4 - Video Call 

(2 Questions)

Round duration - 60 minutes
Round difficulty - Easy

This was a one hour round in which I was first told to introduce myself and then moved to questions.

  • Q1. 

    Permutation in String Problem Statement

    Determine if the string str2 contains a permutation of the string str1 as one of its substrings.

    Input:

    The first line contains an integer 'T', representing the n...
  • Ans. 

    Check if a permutation of one string is a substring of another string.

    • Create a frequency map of characters in str1.

    • Iterate through str2 with a window of size N and check if the frequency map matches.

    • Return 'Yes' if a permutation is found, 'No' otherwise.

  • Answered by AI
  • Q2. 

    Sort 0s, 1s, and 2s Problem Statement

    You are provided with an integer array/list ARR of size 'N' which consists solely of 0s, 1s, and 2s. Your task is to write a solution to sort this array/list.

    Input:

    ...
  • Ans. 

    Sort an array of 0s, 1s, and 2s in linear time with a single scan approach.

    • Use three pointers to keep track of the positions of 0s, 1s, and 2s in the array.

    • Iterate through the array once and swap elements based on their values and the pointers.

    • After the single scan, the array will be sorted in the required order.

  • Answered by AI
Round 5 - Video Call 

(1 Question)

Round duration - 60 minutes
Round difficulty - Medium

This was based more on my communication skills rather than my technical skills. The interviewer didn't only focus on whether I knew the answer or not but if I was able to communicate my knowledge to the interviewer.

It was more of theory based interview
Questions are as follows:-
1. What are SQL and acid properties?

2. How does a website start?

3. What are deadlocks with real life examples? Give necessary conditions for deadlock. 
-> Real life examples were must. 

4. What is virtual function?

5. Tell me the most challenging this while you made your project. ( I had to pick my project on my own) 

6. Tell me the most interesting feature you found working on a language. 

7. Technical question on structures in C as I used it in my project. The interviewer asked if the structure for a linked list is changed as:-
struct node

{
int data;
struct next; 
};
I explained how this won't work as struct will be created again and again which will lead to memory limit exceeded.

  • Q1. 

    Delete Alternate Nodes from a Singly Linked List

    Given a Singly Linked List of integers, remove all the alternate nodes from the list.

    Input:

    The first and the only line of input will contain the elemen...
  • Ans. 

    Remove alternate nodes from a singly linked list of integers.

    • Traverse the linked list and skip every alternate node while updating the next pointers.

    • Make sure to handle cases where there are less than 3 nodes in the list.

    • Update the next pointers accordingly to remove alternate nodes.

    • Example: Input: 10 20 30 40 50 60 -1, Output: 10 30 50

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI completed Information Technology from J.C. Bose University of Science and Technology, YMCA. Eligibility criteriaNo backlogsAmazon interview preparation:Topics to prepare for the interview - Dynamic programming, Algorithms, OOPS, Data Structures, Operating SystemTime required to prepare for the interview - 6 monthsInterview preparation tips for other job seekers

Tip 1 : Listen carefully to what the interviewer expects from you. 
Tip 2 : Practice at least 300 questions, topic wise.
Tip 3 : Do participate in contests.

Application resume tips for other job seekers

Tip 1 : Be true on your resume.
Tip 2 : Make your resume crisp and clear.

Final outcome of the interviewSelected

Skills evaluated in this interview

I appeared for an interview in Dec 2020.

Round 1 - Coding Test 

(2 Questions)

Round duration - 150 minutes
Round difficulty - Medium

Amazon Visited our campus, and they had put a cutoff of 7 CGPA based on which they shortlisted students. After 2 days all the shortlisted students received an online test link.

Online Assessment Test: The round had four sections.

Debugging: There was a total of 7 questions in which a piece of code was written and you had to find any error so that all the test cases can pass. All the questions were very easy.
Coding Section: There were two questions, one was based on a linked list and the other was a logical question based on hashing, I would say both the questions were of medium level. The time allotted was 70 mins total.
Behavioral Analysis: This section consisted of questions that focused on your personality and behavior.
Reasoning Ability: This section was based on aptitude and verbal ability. The difficulty level was easy.

  • Q1. 

    Add Two Numbers as Linked Lists

    You are given two singly linked lists, where each list represents a positive number without any leading zeros.

    Your task is to add these two numbers and return the sum as ...

  • Ans. 

    Add two numbers represented as linked lists and return the sum as a linked list.

    • Traverse both linked lists simultaneously while keeping track of carry.

    • Create a new linked list to store the sum.

    • Handle cases where one linked list is longer than the other.

    • Ensure to update the carry for the next iteration.

  • Answered by AI
  • Q2. 

    Find All Pairs Adding Up to Target

    Given an array of integers ARR of length N and an integer Target, your task is to return all pairs of elements such that they add up to the Target.

    Input:

    The first line ...
  • Ans. 

    Given an array of integers and a target, find all pairs of elements that add up to the target.

    • Iterate through the array and for each element, check if the target minus the element exists in a hash set.

    • If it exists, add the pair to the result. If not, add the element to the hash set.

    • Handle cases where the same element is used twice to form a pair.

    • Return (-1, -1) if no pair is found.

  • Answered by AI
Round 2 - Video Call 

(2 Questions)

Round duration - 90 minutes
Round difficulty - Medium

The round began and first, the interviewer introduced himself and later asked me to introduce myself which I did. After that, he walked me through how the interview is going to proceed from there. He then gave me two coding questions, firstly you have to tell them your approach, and if they are satisfied enough or if your approach is the optimum approach then they will ask you to write that code in their code space which is not an editor btw.

After half an hour I got a call from HR that my interview is scheduled an hour later.

  • Q1. 

    Square Root with Decimal Precision Problem

    Your task is to compute the square root of a given integer N, such that the result is as accurate as D decimal places. The aim is to ensure that the absolute dif...

  • Ans. 

    Compute square root of integer with specified decimal precision.

    • Implement a function to calculate square root using binary search or Newton's method.

    • Keep track of the precision required and stop when the difference is within the limit.

    • Handle multiple test cases efficiently to meet the time limit.

    • Ensure the output is formatted to the specified decimal places.

    • Consider edge cases like maximum input values and precision re...

  • Answered by AI
  • Q2. 

    Spiral Order Traversal of a Binary Tree

    Given a binary tree with N nodes, your task is to output the Spiral Order traversal of the binary tree.

    Input:

    The input consists of a single line containing elem...
  • Ans. 

    Implement a function to return the spiral order traversal of a binary tree.

    • Traverse the binary tree level by level, alternating between left to right and right to left.

    • Use a queue to keep track of nodes at each level.

    • Append nodes to the result list in the order they are visited.

  • Answered by AI
Round 3 - HR 

(2 Questions)

Round duration - 90 minutes
Round difficulty - Easy

The round began with the interviewer’s introduction and then I introduced myself He gave me two questions based on data structures.

The interviewer was happy with all the answers. Then, since enough time was left, He asked me some HR questions, like what are strengths and weaknesses, etc. 

After all this, he told me in the interview itself “See you soon and enjoy your day “, after which I was quite sure that I’m going to go to the next round. But this was the last one.

  • Q1. 

    Connecting Ropes with Minimum Cost

    You are given 'N' ropes, each of varying lengths. The task is to connect all ropes into one single rope. The cost of connecting two ropes is the sum of their lengths. Yo...

  • Ans. 

    Connect ropes with minimum cost by merging two smallest ropes at a time.

    • Sort the array of rope lengths in ascending order.

    • Merge the two smallest ropes at a time and update the cost.

    • Repeat the process until all ropes are merged.

    • Return the total cost as the minimum cost to connect all ropes.

  • Answered by AI
  • Q2. 

    Bottom View of Binary Tree

    Given a binary tree, determine and return its bottom view when viewed from left to right. Assume that each child of a node is positioned at a 45-degree angle from its parent.

    N...

  • Ans. 

    Return the bottom view of a binary tree when viewed from left to right.

    • Traverse the tree in level order and keep track of the horizontal distance and depth of each node

    • For each horizontal distance, update the node in the map if it is deeper than the current node

    • Return the values of the map in sorted order of horizontal distance

  • Answered by AI

Interview Preparation Tips

Professional and academic backgroundI applied for the job as SDE - 1 in BangaloreEligibility criteria7 CGPAAmazon interview preparation:Topics to prepare for the interview - C++, Data Structure, Dynamic Programming, Operating system, System DesignTime required to prepare for the interview - 12 monthsInterview preparation tips for other job seekers

Tip 1 : Practice coding questions and participate in online contests.
Tip 2 : Communication skills are good to have for interviews.
 

Application resume tips for other job seekers

Tip 1 : Do some good projects for your resume.
Tip 2 : Keep it concise and short.
Tip 3 : Don't lie on your resume.

Final outcome of the interviewSelected

Skills evaluated in this interview

Facebook Interview FAQs

How many rounds are there in Facebook Software Developer interview for freshers?
Facebook interview process for freshers usually has 1 rounds. The most common rounds in the Facebook interview process for freshers are HR.

Tell us how to improve this page.

Overall Interview Experience Rating

5/5

based on 1 interview experience

Difficulty level

Moderate 100%

Duration

2-4 weeks 100%
View more
Facebook Software Developer Salary
based on 25 salaries
₹35.3 L/yr - ₹36.4 L/yr
263% more than the average Software Developer Salary in India
View more details

Facebook Software Developer Reviews and Ratings

based on 8 reviews

4.2/5

Rating in categories

4.2

Skill development

4.2

Work-life balance

4.2

Salary

4.1

Job security

4.3

Company culture

4.1

Promotions

4.4

Work satisfaction

Explore 8 Reviews and Ratings
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