Problem 2055. Create numeric palindromes and their square roots
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
Christian Schröder
on 18 Feb 2023
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.
Solution Comments
Show commentsProblem Recent Solvers22
Suggested Problems
-
2723 Solvers
-
Matrix indexing with two vectors of indices
722 Solvers
-
Find a subset that divides the vector into equal halves
387 Solvers
-
Find Index of maximum Value and maximum Value of a vector
165 Solvers
-
Moving average (variable kernel length)
126 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!