Given a number n (1<=n<=9), return a left justified numeric matrix p with all the palindromes of the form 1 to n and back to 1. Use 0 for empty values. Similarly return the square root matrix in the same form.
Example
n=2;
p=[1 0 0; 1 2 1];
r=[1 0 0; 1 1 0];
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers27
Suggested Problems
-
Remove any row in which a NaN appears
8794 Solvers
-
2184 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
14383 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
405 Solvers
-
778 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
The example given is at odds with the test suite: r should always be an n-by-n matrix, so for n = 2, r = [1 0; 1 1] is correct.