Add office photos
Employer?
Claim Account for FREE

Facebook

4.4
based on 159 Reviews
Filter interviews by

20+ Ceasefire Industries Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Saving Money Problem Statement

Ninja is adventurous and loves traveling while being mindful of his expenses. Given a set of 'N' stations connected by 'M' trains, each train starting from station 'A' and reachin...read more

Ans.

The task is to find the cheapest price from the given source to destination with up to K stops.

  • Read the number of test cases

  • For each test case, read the number of stations and trains

  • Read the details of each train (source, destination, ticket price)

  • Read the source station, destination station, and maximum number of stops

  • Implement a graph data structure to represent the stations and trains

  • Use a modified version of Dijkstra's algorithm to find the cheapest price with up to K sto...read more

Add your answer

Q2. Longest Increasing Path in a 2D Matrix Problem Statement

Given a matrix of non-negative integers of size 'N x M', where 'N' and 'M' denote the number of rows and columns respectively, find the length of the lon...read more

Ans.

The task is to find the length of the longest increasing path in a 2D matrix, where you can move in four directions: left, right, up, or down from each cell.

  • Traverse the matrix and for each cell, find the longest increasing path starting from that cell

  • Use dynamic programming to store the length of the longest increasing path for each cell

  • Recursively explore all four directions from each cell, checking if the next cell is greater than the current cell

  • Keep track of the maximum ...read more

Add your answer

Q3. Binary Tree Construction from Preorder and Inorder Traversal

The goal is to construct a binary tree from given preorder and inorder traversal lists of the tree nodes.

Example:

Input:
preorder = [1, 2, 4, 7, 3]
i...read more
Ans.

The task is to construct a binary tree using the given inorder and preorder traversals.

  • Use the preorder traversal to determine the root of the binary tree

  • Use the inorder traversal to determine the left and right subtrees of the root

  • Recursively construct the left and right subtrees

  • Return the root node of the constructed binary tree

Add your answer

Q4. Combination Sum Problem Statement

Given an array of distinct positive integers ARR and a non-negative integer 'B', find all unique combinations in the array where the sum is equal to 'B'. Numbers can be chosen ...read more

Ans.

The task is to find all unique combinations in an array whose sum is equal to a given target sum.

  • Use backtracking to generate all possible combinations

  • Sort the array in non-decreasing order to ensure elements in each combination are in non-decreasing order

  • Start with an empty combination and iterate through the array, adding each element to the combination and recursively calling the function with the remaining sum

  • If the sum becomes zero, add the combination to the result

  • If th...read more

Add your answer
Discover Ceasefire Industries interview dos and don'ts from real experiences

Q5. K Closest Points to Origin Problem Statement

Your house is located at the origin (0,0) of a 2-D plane. There are N neighbors living at different points on the plane. Your goal is to visit exactly K neighbors wh...read more

Add your answer

Q6. 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 subse...read more

Add your answer
Are these interview questions helpful?

Q7. 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 other no...read more

View 2 more answers

Q8. Merging Accounts Problem

Given a list ACCOUNTS where each element consists of a list of strings, with the first element being the name of the account holder, and the subsequent elements being the email addresse...read more

Ans.

The task is to merge accounts belonging to the same person based on common emails and return the merged accounts.

  • Iterate through each account and create a mapping of emails to account holders

  • Iterate through the mapping and merge accounts with common emails

  • Sort the merged accounts and return the result

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. 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 in ARR,...read more
Add your answer

Q10. K - Sum Path In A Binary Tree

Given a binary tree where each node contains an integer value, and a value 'K', your task is to find all the paths in the binary tree such that the sum of the node values in each p...read more

Ans.

The task is to print every path of a binary tree with the sum of nodes in the path as 'K'.

  • Traverse the binary tree and keep track of the current path and its sum

  • At each node, check if the sum of the current path equals 'K'

  • If yes, add the current path to the result

  • Continue traversing the left and right subtrees recursively

  • Remove the current node from the path before backtracking

Add your answer

Q11. Pair Sum Problem Statement

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

Note:

Each pa...read more

Add your answer

Q12. Roman Numeral to Integer Conversion

Convert a string representing a Roman numeral into its integer equivalent and return the result.

Explanation:

Roman numerals are represented by seven different symbols: I, V,...read more

Add your answer

Q13. 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 ever...read more

Add your answer

Q14. 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 and retu...read more

Add your answer

Q15. 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; otherwise, re...read more

Add your answer

Q16. Power Set Generation

Given a sorted array of 'N' integers, your task is to generate the power set for this array. Each subset of this power set should be individually sorted.

A power set of a set 'ARR' is the s...read more

Add your answer

Q17. 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 elements sma...read more

Add your answer

Q18. 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 destination ...read more

Add your answer

Q19. Remove Duplicates from Sorted Array Problem Statement

You are given a sorted integer array ARR of size N. Your task is to remove the duplicates in such a way that each element appears only once. The output shou...read more

Add your answer

Q20. Arithmetic Expression Evaluation Problem Statement

You are provided with a string expression consisting of characters '+', '-', '*', '/', '(', ')' and digits '0' to '9', representing an arithmetic expression in...read more

Add your answer
Q21. How does Facebook store likes and dislikes?
Ans.

Facebook stores likes/dislikes using a combination of databases and caching systems.

  • Likes/dislikes are stored in a distributed database system like Cassandra or HBase.

  • Each like/dislike is associated with a user and the content being liked/disliked.

  • The database is sharded to handle the large volume of likes/dislikes.

  • Caching systems like Memcached or Redis are used to improve read performance.

  • Likes/dislikes can be stored as separate entities or as counters depending on the use ...read more

Add your answer
Q22. How does Facebook implement graph search?
Ans.

Facebook implements graph search by indexing user connections and content to enable efficient search queries.

  • Facebook indexes user connections and content to build a graph database.

  • The graph database is used to store and retrieve information about users, their relationships, and their content.

  • Graph search queries are executed by traversing the graph database to find relevant connections and content.

  • Facebook uses various algorithms and optimizations to improve the efficiency a...read more

Add your answer
Q23. How does Facebook Chat work?
Ans.

Facebook Chat is a real-time messaging system that allows users to send and receive instant messages.

  • Facebook Chat uses a client-server architecture.

  • It utilizes long polling or WebSockets for real-time communication.

  • Messages are stored in a message queue for delivery.

  • Chat messages are encrypted for security.

  • Facebook Chat supports features like read receipts, typing indicators, and group chats.

Add your answer
Q24. What is Hadoop and why is it used?
Add your answer
Q25. Can you explain the concept of demand paging?
Ans.

Demand paging is a memory management technique where pages are loaded into memory only when needed.

  • Demand paging allows for efficient memory utilization by loading pages into memory on demand.

  • It reduces the amount of initial memory required to start a process.

  • When a page is needed but not in memory, a page fault occurs and the required page is loaded from disk.

  • Demand paging allows for larger virtual memory space than physical memory.

  • Examples of demand paging systems include W...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Ceasefire Industries

based on 3 interviews
1 Interview rounds
Coding Test Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

3.9
 • 96 Interview Questions
4.0
 • 27 Interview Questions
3.7
 • 22 Interview Questions
3.5
 • 14 Interview Questions
3.6
 • 12 Interview Questions
4.2
 • 11 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter