Cody

Solution 516192

Submitted on 23 Oct 2014 by Shriramprasad Venkatesan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% tiles = [7 12 8 6 9]; nRows = 2; nCols = 2; omit = 6; board = fill_board(tiles,nRows,nCols); tiles_used = tiles(board(:)); assert(isequal(setdiff(tiles,tiles_used),omit))

l = 7 12 8 6 9 num = 1 2 3 4 5 board = 0 0 0 0 board = 2 0 0 0 l = 7 8 6 9 board = 2 5 0 0 l = 7 8 6 board = 2 5 3 0 l = 7 6 board = 2 5 3 1 l = 6

2   Pass
%% tiles = [12 6 1 20 18 7 4 17]; nRows = 3; nCols = 2; omit = [1 4]; board = fill_board(tiles,nRows,nCols); tiles_used = tiles(board(:)); assert(isequal(setdiff(tiles,tiles_used),omit))

l = 12 6 1 20 18 7 4 17 num = 1 2 3 4 5 6 7 8 board = 0 0 0 0 0 0 board = 4 0 0 0 0 0 l = 12 6 1 18 7 4 17 board = 4 5 0 0 0 0 l = 12 6 1 7 4 17 board = 4 5 8 0 0 0 l = 12 6 1 7 4 board = 4 5 8 1 0 0 l = 6 1 7 4 board = 4 5 8 1 6 0 l = 6 1 4 board = 4 5 8 1 6 2 l = 1 4

3   Pass
%% tiles = [2 10 25 38 39 5 24 14 4]; nRows = 2; nCols = 3; omit = [2 4 5]; board = fill_board(tiles,nRows,nCols); tiles_used = tiles(board(:)); assert(isequal(setdiff(tiles,tiles_used),omit))

l = 2 10 25 38 39 5 24 14 4 num = 1 2 3 4 5 6 7 8 9 board = 0 0 0 0 0 0 board = 5 0 0 0 0 0 l = 2 10 25 38 5 24 14 4 board = 5 4 0 0 0 0 l = 2 10 25 5 24 14 4 board = 5 4 3 0 0 0 l = 2 10 5 24 14 4 board = 5 4 3 7 0 0 l = 2 10 5 14 4 board = 5 4 3 7 8 0 l = 2 10 5 4 board = 5 4 3 7 8 2 l = 2 5 4