I'd suggest adding test cases in which n (or abs(n)) is larger than the dimension of x; for example, x is a 4-by-4 matrix and n = 6.
657 Solvers
Number of 1s in the Binary Representation of a Number
356 Solvers
405 Solvers
2453 Solvers
Is this triangle right-angled?
2872 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!