Cody

Problem 985. Make a Star Pyramid

Solution 149303

Submitted on 16 Oct 2012 by James
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
%% n = 2; p = ['* ';'**']; assert(isequal(pyramid(n),p));

```[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel at 27 In pyramid at 2 In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] ans = 42 32 42 42 ```

2   Pass
%% n = 3; p = ['* ';'** ';'***']; assert(isequal(pyramid(n),p));

```[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel at 27 In pyramid at 2 In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] ans = 42 32 32 42 42 32 42 42 42 ```

3   Pass
%% n = 4; p = ['* ';'** ';'*** ';'****']; assert(isequal(pyramid(n),p));

```[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel at 27 In pyramid at 2 In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] ans = 42 32 32 32 42 42 32 32 42 42 42 32 42 42 42 42 ```

4   Pass
%% n = 10; p = ['* '; '** '; '*** '; '**** '; '***** '; '****** '; '******* '; '******** '; '********* '; '**********']; assert(isequal(pyramid(n),p));

```[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel at 27 In pyramid at 2 In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] ans = 42 32 32 32 32 32 32 32 32 32 42 42 32 32 32 32 32 32 32 32 42 42 42 32 32 32 32 32 32 32 42 42 42 42 32 32 32 32 32 32 42 42 42 42 42 32 32 32 32 32 42 42 42 42 42 42 32 32 32 32 42 42 42 42 42 42 42 32 32 32 42 42 42 42 42 42 42 42 32 32 42 42 42 42 42 42 42 42 42 32 42 42 42 42 42 42 42 42 42 42 ```