FastPrepK-Capable Model Selection
Problems/K-Capable Model Selection

K-Capable Model Selection

Walmart logoWalmart● MediumOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given n machine learning models.

For each model:

  • cost[i] is the cost of the ith model.
  • featureAvailability[i] is a binary string of length 2 describing which features the model supports.

The availability string has the following meaning:

  • "00": supports neither Feature A nor Feature B.
  • "01": supports only Feature B.
  • "10": supports only Feature A.
  • "11": supports both Feature A and Feature B.

A selected set of models is k-capable if at least k selected models support Feature A and at least k selected models support Feature B. A model with availability "11" contributes to both counts.

For every integer k from 1 to n, determine the minimum total cost required to select a k-capable set of models. If it is impossible for a value of k, return -1 for that value.

Function

minimumKCapableCosts(cost: int[], featureAvailability: String[]) → long[]

Complete the function minimumKCapableCosts.

  • int[] cost: the model costs.
  • String[] featureAvailability: the feature availability strings.

Returns long[]: an array of length n, where the k - 1 index stores the minimum total cost for k.

Examples

Example 1

cost = [3, 2, 5]featureAvailability = ["10", "01", "11"]return = [5, 10, -1]

For k = 1, selecting the third model costs 5 and covers both features. For k = 2, all three models are required, for total cost 10. For k = 3, there are not enough models supporting either feature, so the answer is -1.

Constraints

  • cost.length == featureAvailability.length
  • Each featureAvailability[i] is one of "00", "01", "10", or "11".

More Walmart Online Assessment questions

  • Largest Team Where Every Pair OverlapsOA · Seen Nov 2026
  • House RobberOA · Seen Sep 2026
  • Maximum Points by Deleting ElementsOA · Seen Sep 2026
  • Distinct Bitwise-OR Scores of Increasing SubsequencesOA · Seen Sep 2026
  • Best Meeting PointOA · Seen Sep 2026
  • Minimum Cost to Make Array EqualOA · Seen Sep 2026
  • Minimum Stress PathOA · Seen Aug 2026
  • K-Capable Model CostsOA · Seen Jun 2026
  • Minimum Moves to Equal Candy BarsOA · Seen Oct 2024
  • Find Length of Longest Good SubsequenceOA · Seen Feb 2024

Similar questions at other companies

  • Minimum Cost K-Capable ModelsMicrosoft · OAMicrosoft interview questions
  • Minimum Cost of Every K-Capable Model SetTikTok · OATikTok interview questions
  • Maximize Memory PointsAmazon · OA
  • Call Auction Clearing Price and Order FillsHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions
  • Count Lamps Lighting Each PointAirbnb · OAAirbnb interview questions
  • Hiking Club Fastest PaceInfosys · OAInfosys interview questions
  • Find Minimum TimeAlphaSense · OA
  • Find Minimum TimeBlackRock · OABlackRock interview questions
  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
All Walmart interview questionsSee Walmart hiring insights
Saved
class Solution {
    public long[] minimumKCapableCosts(int[] cost, String[] featureAvailability) {
      // write your code here
    }

}
Checking account…