1. You are given N houses, each house can be painted with 3 different colours: red, blue or green 2. Cost of painting each house a certainc colour is different and is given as an N x 3 matrix to you 3. You need to find the minimum amount spent on painting all the houses such that no 2 adjacent houses have the same colour 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main()
Input Format
Input is handled for you
Output Format
Output is handled for you
Constraints
All costs are positive integers
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 1 5 7 5 8 4 3 2 9 1 2 4
Output
8