Problem 801. Construct an index vector from two input vectors in vectorized fashion
Solution Stats
Problem Comments
-
8 Comments
Please do not check for the occurance of "for" in general, because "UniFORmOutput" has nothing to do with looping ;-)
Your predefined function signature has only one parameter, altough two were submitted. Same problem without the "for" restriction: http://www.mathworks.com/matlabcentral/cody/problems/555-low-high-low-high-turn-around-create-a-subindices-vector
This is an excellent problem.
I agree with Dirk. Change your regexp to check for instances of eval, for, and while that are not preceded or followed by additional letters.
give me a hint, should we use a specific function here?
Tip: replace UniformOutput with uni.
Actually arrayfun should also be outlawed, as that simply hides the loop at a performance cost. I haven't seen a vectorized solution yet, only recursions and implicit loops (and the usual cheat-submissions).
If you want a more robust cheat-detection you should have a separate test which runs as first test. That one should not call the submission to avoid it overwriting functions like fileread and assert.
Solution Comments
-
1 Comment
not good
-
1 Comment
'uniformoutput' is innocent orz~~
-
2 Comments
A separate test case that tests for functions that are against the rules would improve this problem. In this case, the "for" in "UniformOutput" was getting caught by the search. A separate test case would have made clear that the solution functions properly but contains an outlawed string.
'Uniformoutput' is now valid, while as for OP's rules for loop is still not allowed.
-
1 Comment
Wonderful !
-
1 Comment
Why x3=[] in the test ?
Nice recursion !
-
1 Comment
Each solution of Richard is a gem.
Problem Recent Solvers345
Suggested Problems
-
Return a list sorted by number of occurrences
2116 Solvers
-
Find state names that start with the letter N
1038 Solvers
-
319 Solvers
-
Find the sum of the elements in the "second" diagonal
1096 Solvers
-
Find out sum and carry of Binary adder
1000 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!