Problem Brief
Find Missing Integer
OA
See IBM online assessment and hiring insights
In the context of data analysis and machine learning, a dataset containing an array of integers has been provided. Each integer is denoted as arr[i] (0 ≤ i < n). The task in this data-centric domain is to predict the kth smallest positive integer that is not found within the dataset, arr.
Note: The smallest positive integer is 1.
Function Description
Complete the function findMissingInteger in the editor below.
findMissingInteger takes the following parameter(s):
int arr[n]: a machine learning datasetlong k: find thekthsmallest positive integer that is not present in the dataset
Returns
long: the kth smallest positive integer that is not in the dataset
1Example 1
Input
arr = [1, 4, 7, 3, 4], k = 5
Output
9
Explanation
The first five missing positive integers are
[2, 5, 6, 8, 9]. The 5th smallest positive integer not in the dataset is 9.Constraints
Limits and guarantees your solution can rely on.
1 ≤ n ≤ 2 * 10^51 ≤ arr[i] ≤ 10^91 ≤ k ≤ 10^12