Computer Science, asked by shreyarathor01, 3 months ago

An apparel company has a list of sales rates of N items from its website. Each item is labeled with a unique ID from 0 to N-1. The company has a target sales rate, say K. The company wishes to know the two items whose total sales rate is equal to the target sales rate. The list of

sales is prepared in such a way that no more han two items' total sales rate will be equal to

the target rate.

Write an algorithm to find the ID of the items whose total sales value is equal to the given target value.​

Answers

Answered by gayatribiradar682
31

Answer:

Write an algorithm to find the ID of the items whose total sales value is equal to the given target value.

Answered by nidaeamann
25

Explanation:

The problem given in question statement can be resolved by taking the combination of all the given N items.

So our algorithm will first start by taking all the sales rates of N items and putting them in an array.

Then we will apply the mathematical formula of combination where every element of an array will make a combination with all other elements in that array and the sum of each combination will be compared against the target rate. That particular combination that will match will give us the two items

Similar questions