Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Amazon Web Services has n servers where the ith server's vulnerability score is vulnerability [ i ] . A client wants to deploy their application
Amazon Web Services has n servers where the ith server's vulnerability score is vulnerabilityi 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.
Example:
k
m
vulnerability
There are contiguous groups of m servers: and
The k nd lowest vulnerability in each group is
Return the answers for each group, in order:
Function Description
Complete the function findKthMinimumVulnerability in the editor below.
findKthMinimumVulnerability has the following parameters:
int k: the order of the vulnerability to find
int m: the number of servers in a group
int vulnerabilityn: the vulnerabilities of each server
Returns:
intn m : the ith element represents the kth minimum vulnerability among the vulnerabilities of all the servers in the ith contiguous group.
Constraints
k m n
vulnerabilityi
Input Format For Custom Testing
The first line contains an integer, k the order of the vulnerability to find.
The second line contains an integer, m the number of servers in a group.
The third line contains an integer, n the size of vulnerability.
Each line i of the n subsequent lines where i n contains an integer, vulnerabilityi
Sample Case
Sample Input For Custom Testing
STDIN FUNCTION
order of vulnerability k
servers in a group m
number of servers n
vulnerability
Sample Output
Explanation
The first group of servers is or when sorted. The rd minimum vulnerability is
The second group of servers is or when sorted. The rd minimum vulnerability is
Sample Case
Sample Input For Custom Testing
STDIN FUNCTION
order of vulnerability k
servers in a group m
number of servers n
vulnerability
Sample Output
Explanation
The first group of servers is or when sorted. The rd minimum vulnerability is
The second group of servers is or when sorted. The rd minimum vulnerability is
Please write c code for the above and use older c versions with TC and SC
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started