Kth Missing Positive Number Problem

Kth Missing Positive Number Problem — ExecCode Easy DSA Practice

Solve the Kth Missing Positive Number problem on ExecCode. Free online easy DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Your task is to compute the required answer and return the k^th positive integer that is missing from this array.

Examples

Input {"arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "k": 10}; Output 20. Input {"arr": [10, 20, 30], "k": 15}; Output 16. Input {"arr": [2, 3, 4, 7, 11], "k": 5}; Output 9

Constraints

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

Practice Kth Missing Positive Number free on ExecCode. Browse DSA problems, topic map, and placement guides.