FastPrepFind Missing and Duplicate Integer
Problems/Find Missing and Duplicate Integer

Find Missing and Duplicate Integer

InMobi logoInMobi● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an InMobi phone screen. One example in the report breaks the report's own rule that there is exactly one missing and one duplicate number, and it has no expected output. We left that example out. Our version follows the stated rule. It is about 94% the same as the usable part of the report.

You are given an integer array nums of length n. It should contain every integer from 1 through n exactly once, but one value is missing and one other value appears twice.

Return a two-element array [missing, duplicate], with the missing value first and the repeated value second.

Function

findMissingAndDuplicate(nums: int[]) → int[]

Examples

Example 1

nums = [1,2,3,4,5,6,7,8,9,10,10]return = [11,10]

The array has length 11. The value 11 is absent, while 10 appears twice.

Example 2

nums = [3,1,2,5,3]return = [4,3]

The value 4 is missing from 1 through 5, and 3 is duplicated.

Constraints

  • 2 <= nums.length <= 2 * 10^5
  • 1 <= nums[i] <= nums.length
  • Exactly one value in 1..nums.length is missing.
  • Exactly one different value appears twice, and every other value appears once.

More InMobi Phone Screen questions

  • House Robber IPHONE SCREEN · Seen Aug 2026
  • Word Break IIPHONE SCREEN · Seen Aug 2026
  • Bus Station Seat AllotmentPHONE SCREEN · Seen Mar 2026
  • Frequency Equals Card ValuePHONE SCREEN · Seen Mar 2026
  • Frog Position After T SecondsPHONE SCREEN · Seen Mar 2026
  • IPOPHONE SCREEN · Seen Mar 2026
  • Evaluate DivisionPHONE SCREEN · Seen Dec 2025
  • Compare Version NumbersPHONE SCREEN · Seen Feb 2022
  • Count Array DerangementsPHONE SCREEN · Seen Feb 2022
  • Maximum Frequency StackPHONE SCREEN · Seen Feb 2022

Similar questions at other companies

  • Adaptive Calibration ErrorOpenAI · PHONE SCREENOpenAI interview questions
  • Find All Pythagorean TripletsDell Technologies · PHONE SCREENDell Technologies interview questions
  • Sort a Quadratic-Transformed ArrayLinkedIn · PHONE SCREENLinkedIn interview questions
  • Bootstrap Mean and Confidence IntervalAmazon · PHONE SCREEN
  • Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions
  • K Closest Points to the OriginWhatNot · PHONE SCREENWhatNot interview questions
  • Minimum Fuel Car AlignmentFivetran · PHONE SCREENFivetran interview questions
  • Pick the K Nearest Grid Points to (0, 0)Capital One · PHONE SCREEN · ONSITE INTERVIEWCapital One interview questions
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Maximum Visible DronesAnduril · PHONE SCREENAnduril interview questions
All InMobi interview questionsSee InMobi hiring insights
Saved
class Solution {
    public int[] findMissingAndDuplicate(int[] nums) {
        // write your code here
    }
}
Checking account…