FastPrepFirst Missing Positive
Problems/First Missing Positive

First Missing Positive

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg new grad onsite interview. Here the solution must run in linear time with constant extra space.

Given an unsorted integer array nums, return the smallest positive integer that does not appear in the array.

Your algorithm must run in O(n) time and use O(1) extra space, excluding the input array.

Function

firstMissingPositive(nums: int[]) → int

Examples

Example 1

nums = [1,2,0]return = 3

The positive values 1 and 2 are present, so 3 is the first missing positive.

Example 2

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

The value 1 is present but 2 is absent.

Example 3

nums = [7,8,9,11,12]return = 1

No value 1 appears.

Constraints

  • 1 <= nums.length <= 100000.
  • -2^31 <= nums[i] <= 2^31 - 1.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Max Points on a LineLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Jump Game IVZomato / Eternal · ONSITE INTERVIEWZomato / Eternal interview questions
  • Process Shopping Records, Promotions, and Display OrderInstacart · PHONE SCREEN · ONSITE INTERVIEWInstacart interview questions
  • Largest Island After One FlipOracle · ONSITE INTERVIEWOracle interview questions
  • Optimal Account BalancingPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Budgeted API Inference with Out-of-Order FeedbackOpenAI · ONSITE INTERVIEWOpenAI interview questions
  • Sliding Window Median of Response TimesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Tallest BillboardAmazon · ONSITE INTERVIEW
  • Randomized Collection with Duplicate ValuesOkta · ONSITE INTERVIEWOkta interview questions
  • Construct a Tree from Level-Order and Inorder TraversalsSalesforce · ONSITE INTERVIEWSalesforce interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int firstMissingPositive(int[] nums) {
      // write your code here
    }
}
Checking account…