Find Kth Minimum Vulnerability

Problem Overview

  • Given vulnerability scores for n AWS servers, report the kth smallest vulnerability for every group of m contiguous servers.
  • Inputs: integers k, m, and array vulnerability[n]. Output: an array of length n−m+1 with each group’s kth minimum, in order.
  • Constraints: 1 ≤ k ≤ m ≤ n ≤ 3e5; 1 ≤ vulnerability[i] ≤ 1e9.
  • Real-world context: choosing a deployment segment with defined risk; an Amazon interviews coding interview interview question problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: