Question: Min Slice Weight Given an Nx N matrix (represented as an array of N arrays each with N elements) calculate the minimum cost vertical slice

 Min Slice Weight Given an Nx N matrix (represented as an

Min Slice Weight Given an Nx N matrix (represented as an array of N arrays each with N elements) calculate the minimum cost vertical slice through the matrix. A slice is a set of elements in the matrix, one in each row, where each element is either directly below, below and left, or below and right of the element above it. The cost is the sum of al elements in the slice Constraints Elements in the NxN matrix will be integers. Input Format A matrix of integers is entered as the dimensions followed by the values. LL1,2,3 L4, 5,6) [7, 8, 911 is entered as 1 2 3 456 789 Output Format Your function must return a single integer representing the minimum slice weight. In the above example you should return 12. The above example has the following slices: (3,5,7),13,5,8),13,5,9),(3,6,8),(3,6,9) The slice with the lowest weight is (1,4,7), which has weight 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!