Cody

# Problem 43754. Lah Numbers

Solution 3836348

Submitted on 25 Nov 2020
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
x = 8; y_correct = [1,0,0,0,0,0,0,0,0;2,1,0,0,0,0,0,0,0;6,6,1,0,0,0,0,0,0;24,36,12,1,0,0,0,0,0;120,240,120,20,1,0,0,0,0;720,1800,1200,300,30,1,0,0,0;5040,15120,12600,4200,630,42,1,0,0;40320,141120,141120,58800,11760,1176,56,1,0;362880,1451520,1693440,846720,211680,28224,2016,72,1]; assert(isequal(lah(x),y_correct))

ans = 2 ans = 6 6 ans = 24 36 12 ans = 120 240 120 20 ans = 720 1800 1200 300 30 ans = 5040 15120 12600 4200 630 42

Index exceeds the number of array elements (0). Error in lah (line 13) y(1:k) Error in Test1 (line 3) assert(isequal(lah(x),y_correct))

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

Index exceeds the number of array elements (0). Error in lah (line 13) y(1:k) Error in Test2 (line 3) assert(isequal(lah(x),y_correct))

3   Fail
x = 3; y_correct = [1,0,0,0;2,1,0,0;6,6,1,0;24,36,12,1]; assert(isequal(lah(x),y_correct))

ans = 2

Index exceeds the number of array elements (0). Error in lah (line 13) y(1:k) Error in Test3 (line 3) assert(isequal(lah(x),y_correct))

4   Fail
x = 10; y_correct = [1,0,0,0,0,0,0,0,0,0,0;2,1,0,0,0,0,0,0,0,0,0;6,6,1,0,0,0,0,0,0,0,0;24,36,12,1,0,0,0,0,0,0,0;120,240,120,20,1,0,0,0,0,0,0;720,1800,1200,300,30,1,0,0,0,0,0;5040,15120,12600,4200,630,42,1,0,0,0,0;40320,141120,141120,58800,11760,1176,56,1,0,0,0;362880,1451520,1693440,846720,211680,28224,2016,72,1,0,0;3628800,16329600,21772800,12700800,3810240,635040,60480,3240,90,1,0;39916800,199584000,299376000,199584000,69854400,13970880,1663200,118800,4950,110,1]; assert(isequal(lah(x),y_correct))

ans = 2 ans = 6 6 ans = 24 36 12 ans = 120 240 120 20 ans = 720 1800 1200 300 30 ans = 5040 15120 12600 4200 630 42 ans = 40320 141120 141120 58800 11760 1176 56 ans = 362880 1451520 1693440 846720 211680 28224 2016 72

Index exceeds the number of array elements (0). Error in lah (line 13) y(1:k) Error in Test4 (line 3) assert(isequal(lah(x),y_correct))

### Community Treasure Hunt

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

Start Hunting!