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.

Create your playground on Tech.io

This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.