Problem 803. Twist 'n' Match
Solution Stats
Problem Comments
-
6 Comments
A lot of solutions don't work with something like n=5 and m=0
Not at all...
For n-by-n matrix, m=1 if n is odd number.
ur problems are really interesting
Thanks Asif!
This problem has some issues because some pairs (n,m) do not have a solution. For instance, it is impossible to find a matrix such that m = n^2 -1 since a rotation pivot does not move. Moreover, there are floor((n^2)/4) cycles of numbers, and when we match the cycle beginning with its end, it creates two matches. It is possible to do some manipulations to have an m greater than n^2 - floor((n^2)/4), but not always.
can you give an example of a matrix before and after?
Solution Comments
-
1 Comment
My code fails for some of the cases I've mentioned. The current leading solution does better (finding some solutions my code can't), yet sometimes it enters into an infinite loop.
-
1 Comment
i had no idea this was gonna work :p
Problem Recent Solvers66
Suggested Problems
-
297 Solvers
-
775 Solvers
-
Get the length of a given vector
7614 Solvers
-
623 Solvers
-
396 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!