Problem 1078. Make a diamond
Given n, odd number > 1, return n by n matrix consist of "null" and "*" characters arranged like a diamond.
No toolbox functions please.
n = 3
m =
* * * *
n = 7
m =
* * * * * * * * * * * *
Solution Stats
Problem Comments
-
4 Comments
may I suggest reinforcing your test suite using isequal or strcmp to hardcoded diamond strings?
updated!
its unclear what the problem wants plz fix
Needs better test suite rather than just checking random things (which is better suited to be the secondary fail safe not the primary).
This is just lazy from the OP.
Solution Comments
Show commentsProblem Recent Solvers108
Suggested Problems
-
Renaming a field in a structure array
1577 Solvers
-
Back to basics 21 - Matrix replicating
1784 Solvers
-
Longest run of consecutive numbers
6419 Solvers
-
Change the sign of even index entries of the reversed vector
633 Solvers
-
Multiples of a Number in a Given Range
939 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!