question archive You are given a sequence of black and white horses, and a set of K stables numbered 1 to K

You are given a sequence of black and white horses, and a set of K stables numbered 1 to K

Subject:Computer SciencePrice: Bought3

You are given a sequence of black and white horses, and a set of K stables numbered 1 to K. You have to accommodate the horses into the stables in such a way that the following conditions are satisfied: You fill the horses into the stables preserving the relative order of horses. For instance, you cannot put horse 1 into stable 2 and horse 2 into stable 1. You have to preserve the ordering of the horses. No stable should be empty and no horse should be left unaccommodated. Take the product (number of white horses * number of black horses) for each stable and take the sum of all these products. This value should be the minimum among all possible accommodation arrangements.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE