Cody

# Problem 1517. Put m balls into n boxes (again)

Solution 1717872

Submitted on 30 Jan 2019
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   Fail
m = 3; n = 2; y_correct = [ 3 0 2 1 1 2 0 3]; assert(isequal(putballs2(m,n),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In putballs2 (line 2) In ScoringEngineTestPoint1 (line 7) In solutionTest (line 3)]

Output argument "y" (and maybe others) not assigned during call to "putballs2". Error in Test1 (line 7) assert(isequal(putballs2(m,n),y_correct))

2   Pass
filetext = fileread('putballs2.m'); assert(isempty(strfind(filetext, 'fopen'))); assert(isempty(strfind(filetext, 'assert'))); assert(isempty(strfind(filetext, 'regexp'))); assert(isempty(strfind(filetext, 'regexprep'))); assert(isempty(strfind(filetext, 'str2num'))); assert(isempty(strfind(filetext, 'if'))); assert(isempty(strfind(filetext, 'persistent'))); assert(isempty(strfind(filetext, 'global'))); assert(isempty(strfind(filetext, 'assignin'))); assert(isempty(strfind(filetext, 'evalin'))); assert(isempty(strfind(filetext, 'char'))); assert(isempty(strfind(filetext, 'interp1'))); assert(isempty(strfind(filetext, 'equal')));

3   Fail
m = 3; n = 4; y_correct = [ 3 0 0 0 2 1 0 0 2 0 1 0 2 0 0 1 1 2 0 0 1 1 1 0 1 1 0 1 1 0 2 0 1 0 1 1 1 0 0 2 0 3 0 0 0 2 1 0 0 2 0 1 0 1 2 0 0 1 1 1 0 1 0 2 0 0 3 0 0 0 2 1 0 0 1 2 0 0 0 3]; assert(isequal(putballs2(m,n),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In putballs2 (line 2) In ScoringEngineTestPoint3 (line 23) In solutionTest (line 7)]

Output argument "y" (and maybe others) not assigned during call to "putballs2". Error in Test3 (line 23) assert(isequal(putballs2(m,n),y_correct))

4   Fail
m = 5; n = 4; y_correct = [ 5 0 0 0 4 1 0 0 4 0 1 0 4 0 0 1 3 2 0 0 3 1 1 0 3 1 0 1 3 0 2 0 3 0 1 1 3 0 0 2 2 3 0 0 2 2 1 0 2 2 0 1 2 1 2 0 2 1 1 1 2 1 0 2 2 0 3 0 2 0 2 1 2 0 1 2 2 0 0 3 1 4 0 0 1 3 1 0 1 3 0 1 1 2 2 0 1 2 1 1 1 2 0 2 1 1 3 0 1 1 2 1 1 1 1 2 1 1 0 3 1 0 4 0 1 0 3 1 1 0 2 2 1 0 1 3 1 0 0 4 0 5 0 0 0 4 1 0 0 4 0 1 0 3 2 0 0 3 1 1 0 3 0 2 0 2 3 0 0 2 2 1 0 2 1 2 0 2 0 3 0 1 4 0 0 1 3 1 0 1 2 2 0 1 1 3 0 1 0 4 0 0 5 0 0 0 4 1 0 0 3 2 0 0 2 3 0 0 1 4 0 0 0 5]; assert(isequal(putballs2(m,n),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In putballs2 (line 2) In ScoringEngineTestPoint4 (line 59) In solutionTest (line 9)]

Output argument "y" (and maybe others) not assigned during call to "putballs2". Error in Test4 (line 59) assert(isequal(putballs2(m,n),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!