You're given two vectors of the same length, x and y, which might be row or a column vectors. Your task is to ensure that y has the same "rowishness" as x: y should be a row vector if x is a row vector, and a column vector if x is a column vector.
Control flow statements (if, switch, for, while, try) and recursion aren't allowed. Neither are arrayfun and friends (cellfun, structfun, varfun, rowfun, spfun). Cheating is possible but made harder, and in any case discouraged.
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers15
Suggested Problems
-
15 Solvers
More from this Author19
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Christian, I would suggest you to update the check for if condition statement to 'if ' (i.e. with a space at the end), as there are functions containing the string 'if' , which are allowed, but fail with the current anti-cheat test suite.
Same for problem #60736. Conditional transpose II.
@Dyuman thanks for the tip. I avoided checking for "if " since it's also possible to write "if(condition)", but perhaps I could just check for both "if " and "if(". That, or try to work with the parse tree instead of fishing for textual matches...
@Dyuman I've updated the test suite, so using functions with "if" in their names should now work. Existing solutions have been rescored.
@Dyuman I've updated the test suite to check for banned keywords/functions based on the parse tree. Hopefully this'll be more robust and cause fewer false positives.