Assertion fails in Cody even though the assertion passes in MATLAB R2014b. Does any one know why?
Hi. The assertion could only have passed outside of Cody if the wrong "correct solution" were specified for comparison, and this would happen if you copy the HTML-rendered text — due to a kind of bug in the way the solution vector is displayed on the Cody webpage (better: copy from the HTML _source code_). -----
The correct solution has delimiters (here shown as ^ for clarity) as in 'this^one^^has^ ^some tricky^stuff', whereas your code produces 'this^one^has^some tricky^stuff', so you don't get the correct result between "one" and "has", nor between "has" and "some".
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = {'hello', 'basic', 'test', 'case'};
y_correct = 'hello basic test case';
assert(isequal(cellstr_joiner(x, ' '),y_correct))
|
2 | Fail |
x = {'this', 'one', '', 'has', ' ', 'some tricky', 'stuff'};
y_correct = 'this one has some tricky stuff';
assert(isequal(cellstr_joiner(x, ' '),y_correct))
|
3 | Pass |
x = {'delimiters', 'are', 'not', 'always', 'spaces'};
y_correct = 'delimiters?are?not?always?spaces';
assert(isequal(cellstr_joiner(x, '?'),y_correct))
|
Find relatively common elements in matrix rows
645 Solvers
Project Euler: Problem 10, Sum of Primes
555 Solvers
244 Solvers
301 Solvers
194 Solvers