FastPrepFind Missing Integer
Problems/Find Missing Integer

Find Missing Integer

IBM logoIBM● MediumOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

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

findMissingInteger(arr: int[], k: long) → long

Complete the function findMissingInteger in the editor below.

findMissingInteger takes the following parameter(s):

  1. int arr[n]: a machine learning dataset
  2. long k: find the kth smallest positive integer that is not present in the dataset

Returns long: the kth smallest positive integer that is not in the dataset

Examples

Example 1

arr = [1, 4, 7, 3, 4]k = 5return = 9

The first five missing positive integers are [2, 5, 6, 8, 9]. The 5th smallest positive integer not in the dataset is 9.

Constraints

  • 1 ≤ n ≤ 2 * 10^5
  • 1 ≤ arr[i] ≤ 10^9
  • 1 ≤ k ≤ 10^12

More IBM interview questions

  • Missing IntervalsOA · Seen Nov 2026
  • Last Object Exit TimeOA · Seen Nov 2026
  • Count Peaks and ValleysOA · Seen Nov 2026
  • Count Strictly Increasing Contiguous WindowsOA · Seen Nov 2026
  • Total Each Letter's Count in an Encoded StringOA · Seen Nov 2026
  • Count Servers With No Requests in a Time WindowOA · Seen Nov 2026
  • Alternate Odd and Even Numbers with Two GoroutinesPHONE SCREEN · Seen Nov 2026
  • Longest Substring Without Repeating CharactersPHONE SCREEN · Seen Nov 2026
  • Maximum Easy Tasks After RearrangingOA · Seen Nov 2026
  • Longest Palindromic SubstringPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions
  • Count Pairs of Overlapping SquaresCapital One · OACapital One interview questions
  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Out-of-Order Bank Ledger BalancesPerplexity AI · OAPerplexity AI interview questions
  • Find Idle Skills QueryAmazon · OA
  • Time Based Key-Value StoreCoalition · OA
  • Time Based Key-Value StoreAtlassian · OAAtlassian interview questions
  • Minimum Operations to Make a SubsequenceGoogle · OAGoogle interview questions
  • Credit Accounts with Scheduled TransfersAirbnb · OAAirbnb interview questions
  • Banking System with Historical SnapshotsCoinbase · OACoinbase interview questions

IBM interview experiences

  • IBM Full-Time SWE OA Questions: 1 Experience
  • IBM Software Intern Résumé Rounds: 2 Experiences (Part 3 of 3)
  • IBM Intern Blitz Interviews: 23 Experiences (Part 2 of 3)
  • IBM Software Intern Interviews: 44 Experiences (Part 1 of 3)
  • IBM Software Intern Interview Questions: 15 Experiences
All IBM interview questionsSee IBM hiring insights
Saved
class Solution {
    public long findMissingInteger(int[] arr, long k) {
      // write your code here
    }

}
Checking account…