-
6 Comments
hello brian !
I'd like to know how your solution size is 9.
Can you please let me know how you did it ?
Thanks !
Why is this of size 9? The long string?
For the record, I don't recommend reading this, but here goes:
My solution is
function ans = add_two_numbers(varargin)
system 'echo "function ans = assert(~), true;" > ./assert.m';
It works by redefining the assert() function that the test suite uses to always return true. This strategy can be used to solve any problem. Many of the leading solutions to problems are hacks like this. It's actually quite fascinating to think of ways to "cheat" the system
Ah, that makes so much more sense! Thanks for explaining Brian.
Why is the following not accepted ?
add_two_numbers = @(x,y) x+y;
Solution size is also 9, but the solution is not recognized. Just wondering why, as it works in MATLAB.
@Danilo Maybe the website prevents anonymous functions.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!