You will be given a cell array of nx2 matrices. Choose one row from each matrix. These are the ordered pairs that will be placed in a line like this.
{[1 2 [4 5 [0 4
3 5 2 4 3 2
1 5] 5 1] 5 3]}
Choices might be: [1 2 3]
yields: [1 2][2 4][5 3]
or: abs(2-2) + abs(4-5)
or: 0 + 1
or: 1
You are trying to minimize the score, the absolute difference of the sum of the difference at the intersections.
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers243
Suggested Problems
-
5025 Solvers
-
Check if number exists in vector
13824 Solvers
-
375 Solvers
-
272 Solvers
-
Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
903 Solvers
More from this Author51
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
this isn't a big deal, but you have inconsistent inputs for your test cases. cases 1 & 3 are 'row vector' cell arrays whereas case 2 is a 'column vector' cell array.
It would be good to amend the Test Suite in the following regards: (1) Add "%%" to the beginning of the first test case, so that Cody interprets it as intended. (2) Include more test cases: currently the twelve smallest 'correct' submissions are all hard-coded cheats. (3) Include test cases in which the minimum score is not zero. (4) Include test cases in which the number of dominoes to be placed "in a line" is not three. —DIV
And (5) Include test cases in which for a particular position there are more than 9 candidate dominoes available.