Cody

Solution 1797687

Submitted on 26 Apr 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   Pass
filetext = fileread('howManyWays.m'); assert(isempty(strfind(filetext, 'assert'))) assert(isempty(strfind(filetext, 'echo')))

2   Fail
x = [1 1 1 1]; y_correct = 1; assert(isequal(howManyWays(x),y_correct))

o = 1 1 1 1 1 1 1 1 1 1 1 1 losses = []

Error using nchoosek (line 65) K must be an integer between 0 and N. Error in howManyWays (line 14) p=nchoosek(west2,2); Error in Test2 (line 3) assert(isequal(howManyWays(x),y_correct))

3   Fail
x = [1 1 1 10]; y_correct = 3; %[14,32,50] assert(isequal(howManyWays(x),y_correct))

o = 1 1 1 1 1 10 1 1 1 10 1 10 losses = [] y = 2

Assertion failed.

4   Pass
x = [12 24 24 30]; y_correct = 5; %[102,114,126,138,150] assert(isequal(howManyWays(x),y_correct))

o = 12 24 12 24 12 30 24 24 24 30 24 30 losses = [] y = 5

5   Pass
x = [22 34 34 43]; y_correct = 6; %[155 167 179 185 197 215] assert(isequal(howManyWays(x),y_correct))

o = 22 34 22 34 22 43 34 34 34 43 34 43 losses = [] y = 6

6   Fail
x = [6 6 10 12]; y_correct = 7; %[36 40 44 48 52 56 60] assert(isequal(howManyWays(x),y_correct))

o = 6 6 6 10 6 12 6 10 6 12 10 12 losses = [] y = 6

Assertion failed.

7   Fail
x = [6 6 7 8]; y_correct = 8; %[32 33 34 35 36 37 38 40] assert(isequal(howManyWays(x),y_correct))

o = 6 6 6 7 6 8 6 7 6 8 7 8 losses = [] y = 7

Assertion failed.

8   Fail
x = [3 4 9 9]; y_correct = 9; assert(isequal(howManyWays(x),y_correct))

o = 3 4 3 9 3 9 4 9 4 9 9 9 losses = [] y = 8

Assertion failed.

9   Fail
x = [4 6 8 11]; y_correct = 10; assert(isequal(howManyWays(x),y_correct))

o = 4 6 4 8 4 11 6 8 6 11 8 11 losses = [] y = 8

Assertion failed.

10   Fail
x = [1 5 6 7]; y_correct = 13; assert(isequal(howManyWays(x),y_correct))

o = 1 5 1 6 1 7 5 6 5 7 6 7 losses = [] y = 11

Assertion failed.

11   Fail
x = [1 2 5 8]; y_correct = 14; assert(isequal(howManyWays(x),y_correct))

o = 1 2 1 5 1 8 2 5 2 8 5 8 losses = [] y = 12

Assertion failed.

12   Fail
x = [1 2 5 10]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 1 2 1 5 1 10 2 5 2 10 5 10 losses = [] y = 13

Assertion failed.

13   Fail
x = [1 2 5 11]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 1 2 1 5 1 11 2 5 2 11 5 11 losses = [] y = 13

Assertion failed.

14   Fail
x = [2 5 9 11]; y_correct = 12; assert(isequal(howManyWays(x),y_correct))

o = 2 5 2 9 2 11 5 9 5 11 9 11 losses = [] y = 11

Assertion failed.

15   Fail
x = [3 8 13 16]; y_correct = 11; assert(isequal(howManyWays(x),y_correct))

o = 3 8 3 13 3 16 8 13 8 16 13 16 losses = [] y = 9

Assertion failed.

16   Fail
x = [7 13 15 16]; y_correct = 11; assert(isequal(howManyWays(x),y_correct))

o = 7 13 7 15 7 16 13 15 13 16 15 16 losses = [] y = 10

Assertion failed.

17   Fail
x = [3 34 43 47]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 3 34 3 43 3 47 34 43 34 47 43 47 losses = [] y = 13

Assertion failed.

18   Fail
x = [21 35 38 39]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 21 35 21 38 21 39 35 38 35 39 38 39 losses = [] y = 13

Assertion failed.

19   Fail
x = [5 10 34 36]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 5 10 5 34 5 36 10 34 10 36 34 36 losses = [] y = 13

Assertion failed.

20   Fail
x = [ 55 97 154 193]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 55 97 55 154 55 193 97 154 97 193 154 193 losses = [] y = 13

Assertion failed.

21   Fail
x = [107 116 165 170]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 107 116 107 165 107 170 116 165 116 170 165 170 losses = [] y = 13

Assertion failed.

22   Fail
x = [329 592 611 641]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 329 592 329 611 329 641 592 611 592 641 611 641 losses = [] y = 13

Assertion failed.

23   Fail
x = [3259 4164 5259 6544]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 3259 4164 3259 5259 3259 6544 4164 5259 4164 6544 5259 6544 losses = [] y = 13

Assertion failed.

24   Fail
x = [5947 6267 8477 9254]; y_correct = 15; assert(isequal(howManyWays(x),y_correct))

o = 5947 6267 5947 8477 5947 9254 6267 8477 6267 9254 8477 9254 losses = [] y = 13

Assertion failed.

25   Pass
x = [726 871 871 964]; y_correct = 6; %[4158 4303 4448 4489 4634 4820] assert(isequal(howManyWays(x),y_correct))

o = 726 871 726 871 726 964 871 871 871 964 871 964 losses = [] y = 6