FastPrepK-Capable Model Costs
Problems/K-Capable Model Costs

K-Capable Model Costs

Walmart logoWalmart● MediumOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Corrected on 2026-07-18. The same core task was independently reported in another Walmart source. This judged version matches the reported task at about 95%, and its 64-bit output supports the stated bounds.

There are n machine learning models. Model i has cost cost[i] and a two-character string featureAvailability[i]:

  • "00": supports neither feature.
  • "01": supports Feature B only.
  • "10": supports Feature A only.
  • "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 "11" model counts toward both totals.

For every k from 1 to n, return the minimum total cost needed to choose a k-capable set. If no such set exists, return -1 for that k.

Return a long[] containing the answers for k = 1 through n.

Function

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

Examples

Example 1

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

For k = 1, either the dual-feature model or the two single-feature models cost 5. For k = 2, the first three useful models cost 10. Larger values of k are impossible.

Example 2

cost = [8,1,2,6]featureAvailability = ["11","10","01","11"]return = [3,9,17,-1]

For k = 1, pair the models costing 1 and 2. For k = 2, also choose the dual-feature model costing 6. For k = 3, all four models are required. The value k = 4 is impossible.

Constraints

  • 1 <= n <= 10^5
  • 1 <= cost[i] <= 10^9
  • 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 SelectionOA · 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

  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Minimum Cost K-Capable ModelsMicrosoft · OAMicrosoft interview questions
  • Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Maximize Minimum Deployment DifficultyJP Morgan Chase · OAJP Morgan Chase interview questions
  • Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
  • Maximize Center A Package BenefitAmazon · OA
  • EV Charging Cost OptimizationTata Consultancy Services · OATata Consultancy Services interview questions
  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
All Walmart interview questionsSee Walmart hiring insights
Saved
class Solution {
    public long[] getMinimumModelCosts(int[] cost, String[] featureAvailability) {
      // write your code here
    }

}
Checking account…