Cody

# Problem 556. Stuff the Board

Solution 372246

Submitted on 18 Dec 2013 by Robert
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))

omit = [] board = [] ntiles = 7 12 8 6 9 omit = 6 tiles = 7 12 8 9 board = 1 board = 1 2 board = 1 2 3 board = 1 2 3 5 board = 1 3 2 5

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))

omit = [] board = [] ntiles = 12 6 1 20 18 7 4 17 omit = 1 tiles = 12 6 20 18 7 4 17 omit = 1 4 tiles = 12 6 20 18 7 17 board = 1 board = 1 2 board = 1 2 4 board = 1 2 4 5 board = 1 2 4 5 6 board = 1 2 4 5 6 8 board = 1 5 2 6 4 8

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))

omit = [] board = [] ntiles = 2 10 25 38 39 5 24 14 4 omit = 2 tiles = 10 25 38 39 5 24 14 4 omit = 2 4 tiles = 10 25 38 39 5 24 14 omit = 2 4 5 tiles = 10 25 38 39 24 14 board = 2 board = 2 3 board = 2 3 4 board = 2 3 4 5 board = 2 3 4 5 7 board = 2 3 4 5 7 8 board = 2 4 7 3 5 8