Skip to content

Practice Kth Missing Positive Number

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1539
LeetCode Problem

Kth Missing Positive Number

Problem Statement

Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Return the kth positive integer that is missing from this array. Example 1: Example 2: Constraints: Follow up: Could you solve this problem in less than O(n) complexity?

Source: Kth Missing Positive Number on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
arr = [2,3,4,7,11], k = 5
Output
9

# Example 2

Input
arr = [1,2,3,4], k = 2
Output
6

Constraints

1 <= arr.length <= 1000
1 <= arr[i] <= 1000
1 <= k <= 1000
arr[i] < arr[j] for 1 <= i < j <= arr.length

Related LeetCode Problems

Practice more problems similar to Kth Missing Positive Number.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.