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 largest elements in the array but are not present in the array itself. The missing numbers need to be returned in a sorted order.
Example:
Input:
ARR = [4, 2, 9]
Output:
3 5 6 7 8
Explanation:
The numbers 3, 5, 6, 7, and 8 are within the range of the elements in ARR
but are not found within the array itself.
Constraints:
- 1 <= T <= 10
- 1 <= N <= 105
- 0 <= ARR[i] <= 150000
Note:
No need to print the output explicitly. Implement the function to return the result.

AnswerBot
4mo
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 n...read more
Help your peers!
Add answer anonymously...
Ola Cabs Software Developer interview questions & answers
A Software Developer was asked 7mo agoQ. What is a closure?
A Software Developer was asked Q. Minimum Number Of Taps To Water Garden Problem Statement You are required to det...read more
A Software Developer was asked Q. Count Leaf Nodes in a Binary Tree Given a binary tree, your task is to count and...read more
Popular interview questions of Software Developer
A Software Developer was asked Q1. Minimum Number Of Taps To Water Garden Problem Statement You are required to det...read more
A Software Developer was asked Q2. Count Leaf Nodes in a Binary Tree Given a binary tree, your task is to count and...read more
A Software Developer was asked Q3. Diagonal Traversal of a Binary Tree Problem Statement Given a binary tree, your ...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

