Given a and b, return the sum a+b in c.
A quick easy start! xD
I tried. But caught with error.
it is very easy to abuse the solution map by writing a correct solution with a lot of useless code before it. I tested this and got the solution map rescaled to absurdity (and I see I'm not the only one). Please correct this.
1st try :)
I did it
quick and easy start
this is cool!
This was a good problem/solution to start out on.
this is a bad solution
What is wrong with this solution?
the code is wrong because the function name should be 'add_two_numbers'.
In the test code the are evaluating:
So if your function is called 'sum' it wont be called by the test script.
Try writing out the equation you want to use, with 'c =' on the left, and 'a' and 'b' on the right. You don't need to define c =.., a =.., or b =.. in the function.
hello brian !
I'd like to know how your solution size is 9.
Can you please let me know how you did it ?
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.
This challenge was quite simple. Good for beginners.
self explainable code. thanks to cody team
Error: Undefined function 'add_two_numbers' for input arguments of type 'double'
this is not a function?
Can you explain how does it work?
why this is working?
It was a system error. I re-scored the solution, and that did the right thing.
fast fourier transform should be fast anywhere,right?? why not here?xaxa Funny approach
Of course, c = a+b; is entirely correct, using the operator form for addition. plus(a,b) uses the function form.
letter yes yes & letter no no
"Low : High - Low : High - Turn around " -- Create a subindices vector
Number of 1s in a binary string
Implement simple rotation cypher
convert matrix to single column
It dseon't mettar waht oedrr the lrettes in a wrod are.
The Goldbach Conjecture
Find the sum of all the numbers of the input vector
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office