Feature #9: Kth Missing Gene

Implement the "Kth Missing Gene" feature for our "Computational Biology" project.

Description

A planet has n genes, numbered 1 to n. Every species on the planet has a subset of these genes in its DNA sequence. For a given species’ DNA, A, we want to find the kthk^{th} missing gene in a sorted order. The given DNA sequence will be sorted in strictly increasing order.

Constraints

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

The following examples may clarify this problem:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.