Add office photos
Employer?
Claim Account for FREE

Ola Cabs

3.4
based on 1.9k Reviews
Video summary
Filter interviews by

10+ BYJU'S Exam Prep Interview Questions and Answers

Updated 24 Oct 2024
Popular Designations

Q1. Problem: Permutations of a String

Given a string STR consisting of lowercase English letters, your task is to return all permutations of the given string in lexicographically increasing order.

Explanation:

A st...read more

Ans.

Return all permutations of a given string in lexicographically increasing order.

  • Use backtracking to generate all permutations of the string.

  • Sort the permutations to get them in lexicographically increasing order.

  • Ensure the string contains unique characters to avoid duplicate permutations.

Add your answer

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

Ans.

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

  • Use a combination of hashmap and doubly linked list to implement the LRU cache.

  • Keep track of the least recently used item and evict it when the cache reaches its capacity.

  • Update the position of an item in the cache whenever it is accessed or updated.

  • Handle both get and put operations efficiently to maintain the LRU property.

  • Ensure the time complexity of get an...read more

Add your answer

Q3. Count Leaf Nodes in a Binary Tree

Given a binary tree, your task is to count and return the number of leaf nodes present in it.

A binary tree is a data structure where each node has at most two children, referr...read more

Ans.

Count and return the number of leaf nodes in a binary tree.

  • Traverse the binary tree and count nodes with both left and right children as NULL.

  • Use recursion to traverse the tree efficiently.

  • Leaf nodes have no children, so check for NULL left and right children to identify them.

Add your answer

Q4. Diagonal Traversal of a Binary Tree Problem Statement

Given a binary tree, your task is to determine the diagonal traversal of the tree.

Example:

Input:
1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1
Output:
1 3 6 2 5 4...read more
Ans.

Diagonal traversal of a binary tree involves traversing nodes diagonally from top to bottom and left to right.

  • Traverse the tree level by level, starting from the root node.

  • For each level, keep track of the diagonal nodes and their children.

  • Use a queue to store nodes at each level and traverse them accordingly.

  • Example: For input 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the diagonal traversal is 1 3 6 2 5 4 7.

Add your answer
Discover BYJU'S Exam Prep interview dos and don'ts from real experiences

Q5. Minimum Number Of Taps To Water Garden Problem Statement

You are required to determine the minimum number of taps that need to be opened to water an entire one-dimensional garden defined along the x-axis, which...read more

Ans.

Find the minimum number of taps to water an entire garden along the x-axis.

  • Iterate over the taps and find the farthest point each tap can reach.

  • Sort the taps based on their starting points and use a greedy approach to select the taps.

  • Keep track of the farthest point reachable by the selected taps and the number of taps opened.

  • Return the minimum number of taps needed to water the entire garden or -1 if it's impossible.

Add your answer

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

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 all eight possible directions for connectivity while traversing the matrix.

  • Handle edge cases such as out of bounds indices and already visited cell...read more

Add your answer
Are these interview questions helpful?

Q7. Find the Kth Row of Pascal's Triangle Problem Statement

Given a non-negative integer 'K', determine the Kth row of Pascal’s Triangle.

Example:

Input:
K = 2
Output:
1 1
Input:
K = 4
Output:
1 4 6 4 1

Constraints...read more

Ans.

The task is to find the Kth row of Pascal's Triangle given a non-negative integer K.

  • Create an array to store the elements of the Kth row of Pascal's Triangle.

  • Use the formula C(n, k) = C(n-1, k-1) + C(n-1, k) to calculate each element in the row.

  • Return the array containing the Kth row of Pascal's Triangle.

Add your answer

Q8. Missing Numbers Problem Statement

You are provided with an array called ARR, consisting of distinct positive integers. Your task is to identify all the numbers that fall within the range of the smallest and lar...read more

Ans.

Identify missing numbers within the range of smallest and largest elements in an array.

  • Find the smallest and largest elements in the array.

  • Generate a list of numbers within this range.

  • Filter out the numbers present in the array.

  • Return the missing numbers in sorted order.

Add your answer
Share interview questions and help millions of jobseekers 🌟
Q9. Design a toll booth system for Ola cabs and explain the necessary functions and data structures used in it.
Ans.

Design a toll booth system for Ola cabs with necessary functions and data structures.

  • Use a queue data structure to manage the order of vehicles waiting at the toll booth.

  • Implement functions for vehicle entry, toll calculation, and exit.

  • Store vehicle information such as license plate number, type of vehicle, and toll amount in a hash map.

  • Utilize a priority queue to handle VIP or premium customers efficiently.

  • Include a function to generate toll receipts for each transaction.

Add your answer
Q10. Can you describe the system design of the OLA app?
Ans.

OLA app system design involves multiple components like user interface, driver matching algorithm, payment processing, etc.

  • User interface for booking rides and tracking

  • Driver matching algorithm based on location and availability

  • Payment processing for seamless transactions

  • Real-time tracking of rides for both users and drivers

Add your answer

Q11. What is Closure

Ans.

Closure is a function that captures the environment in which it was created, allowing it to access variables from that environment even after the function has finished executing.

  • Closure allows a function to access variables from its outer scope even after the function has finished executing.

  • It is created when a function is defined within another function and the inner function references variables from the outer function.

  • Closure helps in maintaining state in functional progra...read more

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

Interview Process at BYJU'S Exam Prep

based on 5 interviews
Interview experience
3.4
Average
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
 • 67 Interview Questions
4.3
 • 36 Interview Questions
3.8
 • 35 Interview Questions
4.1
 • 31 Interview Questions
3.5
 • 18 Interview Questions
4.2
 • 10 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