Company: ubs_29july
Difficulty: medium
Question 31 Problem Description You are given a collection of items and their associated costs, where each item can have multiple cost options. There are numItems total items, labeled from 0 to numItems - 1 . You have two integer arrays that define the available cost options, itemid and cost . For each k th entry, itemid[k] is the label of the item for the k th cost entry and cost[k] is the cost associated with that item. Implement a function that returns the minimum total cost to select exactly one cost entry for each item. If it is impossible to select exactly one cost entry for each item, return -1. The function minTotalCost takes the following inputs: int numItems : the total number of items labeled from 0 to numItems - 1 int itemid[] : an array of item labels for each cost entry int cost[] : an array containing the corresponding costs for each entry The function should return a long integer representing the minimum total cost to select all the items, or -1 if it is impossible to s