Cody

Problem 45368. Sky full of stars - 01

Solution 2162271

Submitted on 17 Mar 2020 by William
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
a= ['* ' '** ' '*** ' '**** ' '*****'] assert(isequal( star_pattern(5,'bl'),a))

a = 5×5 char array '* ' '** ' '*** ' '**** ' '*****'

2   Pass
a= [' *' ' **' ' ***' ' ****' ' *****' '******'] assert(isequal( star_pattern(6,'br'),a))

a = 6×6 char array ' *' ' **' ' ***' ' ****' ' *****' '******'

3   Pass
a= ['****' ' ***' ' **' ' *'] assert(isequal( star_pattern(4,'tr'),a))

a = 4×4 char array '****' ' ***' ' **' ' *'

4   Pass
a= [ '**********' '********* ' '******** ' '******* ' '****** ' '***** ' '**** ' '*** ' '** ' '* '] assert(isequal( star_pattern(10,'tl'),a))

a = 10×10 char array '**********' '********* ' '******** ' '******* ' '****** ' '***** ' '**** ' '*** ' '** ' '* '

5   Pass
a= [ '***************' ' **************' ' *************' ' ************' ' ***********' ' **********' ' *********' ' ********' ' *******' ' ******' ' *****' ' ****' ' ***' ' **' ' *'] assert(isequal( star_pattern(15,'tr'),a))

a = 15×15 char array '***************' ' **************' ' *************' ' ************' ' ***********' ' **********' ' *********' ' ********' ' *******' ' ******' ' *****' ' ****' ' ***' ' **' ' *'