Cody

Problem 1843. Optimally fill a container with elements of different sizes

Solution 1771074

Submitted on 3 Apr 2019 by Abdelfatah Teamah
• Size: 8
• This is the leading solution.
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
V = [ 0.68 0.59 2.05 2.64 2.55 1.89 2.04 1.29 1.34 0.63 ]; L = 4.63; A_correct = [ 4.62 1 ]; assert(isequal(fillitup(V,L),A_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 fillitup (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)]

2   Pass
V = [ 51 98 64 21 3 12 16 10 31 81 ]; L = 108; A_correct = [ 108 3 ]; assert(isequal(fillitup(V,L),A_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 fillitup (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

3   Pass
V = [ 0 0 1 1 1 ]; L = 2.2; A_correct = [ 2 12 ]; assert(isequal(fillitup(V,L),A_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 fillitup (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]