FastPrepMinimum Cost K-Capable Models
Problems/Minimum Cost K-Capable Models

Minimum Cost K-Capable Models

Microsoft logoMicrosoft● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: About 98% source match. The source gives the feature-count objective, bounds and return values. The practice callable uses minimumKCapableModelCosts; the full six-model example is retained from the earlier source.

Given n machine learning models, each model has an associated cost and feature compatibility:

  • cost[i] is the cost of the i-th model.
  • featureAvailability[i] is a two-character binary string:
    • "00": suitable for neither feature.
    • "01": suitable for feature A but not feature B.
    • "10": suitable for feature B but not feature A.
    • "11": suitable for both features.

A set of models is k-capable when the number of selected models suitable for feature A and the number suitable for feature B are both at least k.

For every k from 1 through n, determine the minimum cost required to assemble a k-capable set. Return an array of n integers, where the value at index k - 1 is that minimum cost. If no k-capable set exists, return -1 for that position.

Function

minimumKCapableModelCosts(cost: int[], featureAvailability: String[]) → int[]

Examples

Example 1

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

Model numbers are 1-based. For k = 1, model 5 supports both features and costs 2. For k = 2, models 1, 4 and 5 cost 3 + 1 + 2 = 6; each feature has two supporters. For k = 3, add model 3, which costs 9 and supports both features, for a total of 15. For k = 4, all six models are required and cost 26. Each feature has only four supporters in the full set, so k = 5 and k = 6 are impossible.

Constraints

  • 1 <= cost.length <= 100000
  • featureAvailability.length == cost.length
  • 1 <= cost[i] <= 10000
  • featureAvailability[i].length == 2
  • Each feature string is one of 00, 01, 10, or 11.

More Microsoft Online Assessment questions

  • Authentication SystemOA · Seen Nov 2026
  • Maximum String OperationsOA · Seen Nov 2026
  • Minimum Cost to Process Priority TasksOA · Seen Nov 2026
  • Most Visited Sprint MarkerOA · Seen Nov 2026
  • Maximum Escape Game ScoreOA · Seen Nov 2026
  • Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
  • Maximum Interactive Team SizeOA · Seen Nov 2026
  • Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
  • Find Available Meeting RoomsOA · Seen Oct 2026
  • Maximum Sum of a K-StarOA · Seen Oct 2026

Similar questions at other companies

  • Call Auction Clearing Price and Order FillsHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Minimum Cost of Every K-Capable Model SetTikTok · OATikTok interview questions
  • Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Optimal TransferSnowflake · OASnowflake 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

Microsoft interview experiences

  • Microsoft OA Questions, October 2026: 4 Experiences
  • Microsoft Experienced SWE Phone Screen: 1 Experience
  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public int[] minimumKCapableModelCosts(int[] cost, String[] featureAvailability) {
      // write your code here
    }

}
Checking account…