Problem 54780. Trap a knight
Solution Stats
Problem Comments
-
1 Comment
my solution (using brute force) is giving the right answer (on the test cases I checked) but it's failing in Cody due to time constraints. I hate it when it does that.
in test case - 5, tic-toc is giving me 5s. I might be able to optimize the code a little more but I am not sure that would be enough. I think it's failing on the loop test cases due to runtime.
is it necessary to use loop cases as they tend to take a long time? why not just random settings?
Solution Comments
-
2 Comments
Any hints as how I can speed up my code? Am a missing some pattern? Seems like brute force is the way to go.
If you are missing a pattern, then I am too. The solutions so far (including mine) use brute force. Is SORT the problem?
Problem Recent Solvers2
Suggested Problems
-
945 Solvers
-
Project Euler: Problem 10, Sum of Primes
1304 Solvers
-
458 Solvers
-
Replace all zeros and NaNs in a matrix with the string 'error'
96 Solvers
-
Split a string into chunks of specified length
1191 Solvers
More from this Author185
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!