House Party
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
The goal today is to write a function that returns the min cost of catering all house parties. There are three types of snacks available with the cost of each being different at each house. The costs are all positive and are represented by an n * 3 cost matrix of all the houses (For example, costs[0][0] is the cost of feeding house 0 with snack ceviche; costs[1][2] is the cost of feeding house 1 with snack samosas, and so on...). No two adjacent house parties may have the same hors d'oeuvres, because everyone wants to think their party is the better than the one next door.
Check for the minimum cost
Write an getMin
function that takes a n * 3 matrix as a parameter and returns the minimum catering cost.