-
3 Comments
Innovative, but a bit risky/lucky: roughly a 20–30% risk of failing the Test Suite, by my estimation [see Solutions 1572717–1572721, and Solution 1572713; cf. Solution 1572418].
Since the Monte-Carlo errors decrease proportionally to 1/sqrt(N), where N is the number of random numbers, you should always be able to choose a large enough N to nearly always pass the tests. This is only limited by the execution-time limit that cody enforces.
I agree that it is possible to choose N in such a way as to be practically guaranteed to pass the Test Suite. My point is that in this submission (and BTW also in Solution 188645) N has been chosen smaller than that, and so some luck was needed for this submission to pass — there was a significant risk that it could have failed.
Suggested Problems
-
Determine whether a vector is monotonically increasing
21335 Solvers
-
374 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
11967 Solvers
-
Count consecutive 0's in between values of 1
455 Solvers
-
1391 Solvers
More from this Author7
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!