FastPrepMinimum Server Vulnerability
Problems/Minimum Server Vulnerability

Minimum Server Vulnerability

Cashfree Payments logoCashfree Payments● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Cashfree Payments online assessment. Our version is about 99% the same as the reported question.

You are given an array of positive integers vulnerability. Choose exactly k server positions so that no two chosen positions are adjacent.

The vulnerability of a selection is the maximum value among its chosen servers. Return the minimum possible vulnerability of any valid selection.

Function

getMinVulnerability(vulnerability: int[], k: int) → int

Examples

Example 1

vulnerability = [2,3,5,9]k = 2return = 5

The valid pairs are [2,5], [3,9], and [2,9]. Their maximum values are 5, 9, and 9, so the minimum possible vulnerability is 5.

Example 2

vulnerability = [2,4,6,8,10]k = 2return = 6

Choosing positions 0 and 2 gives vulnerability 6. Any valid pair with a smaller maximum would need two non-adjacent values from 2 and 4, but those positions are adjacent.

Constraints

  • 1 <= vulnerability.length <= 10^5.
  • 1 <= vulnerability[i] <= 10^9.
  • 1 <= k <= (vulnerability.length + 1) / 2.

More Cashfree Payments interview questions

  • Largest SubsequencesOA · Seen Aug 2022
  • Pairs of Songs With Total Durations Divisible by 120PHONE SCREEN · Seen Dec 2026

Similar questions at other companies

  • Minimum Non-Adjacent Selection CapabilityMicrosoft · OAMicrosoft interview questions
  • Rock JumpingIMC Trading · OAIMC Trading interview questions
  • Minimum Robot and Human Fulfillment TimeAmazon · OA
  • Minimize Maximum Group DifferenceDRW · OADRW interview questions
  • Array NullificationQRT · OA
  • Minimum-Cost Solar Rooftop AllocationDeloitte · OADeloitte interview questions
  • Three-Part Partition with Minimum Largest RangeLSEG · OALSEG interview questions
  • K-Means ClusteringAtlassian · OAAtlassian interview questions
  • Get Minimum Development TimeSalesforce · OASalesforce interview questions
  • Job ExecutionMathWorks · OAMathWorks interview questions
See Cashfree Payments hiring insights
Saved
class Solution {
    public int getMinVulnerability(int[] vulnerability, int k) {
        // Write your code here.
    }
}
Checking account…