Problem Β· Sliding Window
Find Kth Minimum Vulnerability
Learn this problemProblem statement
Note π - Another problem related to find server vulnerability Find Least Possible Vulnerability π¦₯
Amazon Web Services has n servers where the ith server's vulnerability score is vulnerability[i]. A client wants to deploy their application on a group of m contiguous servers. The vulnerability of a group is defined as the kth minimum vulnerability among the chosen servers. Find the vulnerability of each possible group of m contiguous servers the client can choose.
Function
findKthMinimumVulnerability(k: int, m: int, vulnerability: int[]) β int[]
Complete the function findKthMinimumVulnerability in the editor below.
findKthMinimumVulnerability has the following parameter(s):
int k: the order of the vulnerability to findint m: the number of servers in a groupint vulnerability[n]: the vulnerabilities of each server
Returns
int[]: the vulnerabilities for each group, in order
Examples
Example 1
k = 2m = 3vulnerability = [1, 3, 2, 1]return = [2, 2]There are 2 contiguous groups of
m = 3 servers: [1, 3, 2] and [3, 2, 1].
The k = 2ndnd lowest vulnerability in each group is 2.
Return the answers for each group, in order: [2, 2].Example 2
k = 3m = 4vulnerability = [4, 2, 3, 1, 1]return = [3, 2]No explanation's found so far. If you happen to know about it. You're more than welcome to lmk! Many thanks in advance! π§‘
Constraints
1 <= k <= m <= n <= 3*10^5 1 <= vulnerability[i] <= 10^9More Amazon problems
- Drone Delivery RouteOA Β· Seen Jul 2026
- Detect a Keyword SubstringONSITE INTERVIEW Β· Seen Jul 2026
- Find Maximum Total Amount (SDE I, Fungible :)OA Β· Seen Jul 2026
- Find the Root of a Directed TreeONSITE INTERVIEW Β· Seen Jul 2026
- Meeting Rooms IIPHONE SCREEN Β· ONSITE INTERVIEW Β· Seen Jul 2026
- Merge IntervalsOA Β· ONSITE INTERVIEW Β· Seen Jul 2026
- Single Element in a Sorted ArrayPHONE SCREEN Β· Seen Jul 2026
- Count the Number of Complete ComponentsPHONE SCREEN Β· Seen Jul 2026