Company: Confluent_6nov
Difficulty: medium
Problem Description You are managing a repository of machine learning models. You are given a table named models that contains information about each model's cost and its compatibility with two distinct features: Feature A and Feature B . A set of models is considered k -capable if the set contains at least k models suitable for Feature A and at least k models suitable for Feature B. A model suitable for both features simultaneously counts towards both requirements. Write a SQL query to determine the minimum total cost required to assemble a k -capable set of models for each value of k from 1 to n , where n is the total number of models in the table. If no k -capable set exists for a specific value of k , the minimum cost should be evaluated as -1 . Schema models Table Column Name Type Description model_id INT Unique identifier for the machine learning model. cost INT The cost of adding this model to the set. feature_availability VARCHAR(2) A 2-character binary string indicating suitab