How can this solution code have a size of 8? It's ONE LINE!
There is a nifty trick for reducing what seems like the shortest possible solution. I don't really want to just state the trick, as it is fun to learn or discover on your own.
If you can't figure it out, I suggest that you submit a simple problem to Cody, and look at the solutions. (They will all be viewable to you, as the problem submitter.) Someone will use the trick, almost certainly.
So does this trick work in the actual application as well, or is it related to how Cody calculates the code size?
I mean will this "trick" actually improve the performance in Matlab env?
No, the trick is actually fairly poor coding practice
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = 'But I''m actually right this time';
y_correct = 'yes';
assert(isequal(wiferight(x),y_correct))
|
2 | Pass |
%%
x = 'But you just said that 2+2=3';
y_correct = 'yes';
assert(isequal(wiferight(x),y_correct))
|
2282 Solvers
Sum all integers from 1 to 2^n
6334 Solvers
Vectorize the digits of an Integer
236 Solvers
MATCH THE STRINGS (2 CHAR) very easy
194 Solvers
Deleting an element in a matrix
242 Solvers