Problem 2160. The 17x17 Problem
This problem is sometimes referred to as the 17x17 challenge. See also Part 1 and Part 2 of this problem. This time, your job is to construct, for the given n, an n-by-n matrix in which there are no rectangles. A rectangle is a formed whenever four instances of the same value appear in the corners of a rectangular region of the matrix.
Examples:
Input n = 3
Output a = [ 4 1 2 1 4 3 2 1 1 ]
Input n = 5 Output a = [ 4 1 2 4 1 3 3 2 1 4 3 2 4 1 1 1 4 3 2 2 1 1 1 4 4 ]
The answer for a given n is not unique. The test suite will just guarantee that there are no rectangles present.
Note 1. I am using Alfonso's solution 191508 from problem 514 as my testing code. Cody in the service of Cody!
Note 2. You can easily answer this problem with a pre-computed response. You could do that, but it would be lame. We want to see your code!
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
Remove any row in which a NaN appears
8659 Solvers
-
Determine if a Given Number is a Triangle Number
383 Solvers
-
Sum all integers from 1 to 2^n
16119 Solvers
-
"Low : High - Low : High - Turn around " -- Create a subindices vector
549 Solvers
-
Decrypt the cypher using XOR encryption (for beginners)
48 Solvers
More from this Author50
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!