Cody

Problem 43320. Expand a term

Solution 1007454

Submitted on 10 Oct 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
f = '2(x + y)'; y = expandf(f); validatestring(y,{'2 ( x + y )'}) assert(isequal(y,'2 ( x + y )'),'Not that kind of expansion ;)')

Error using VisibleTest1 (line 3) Expected input to match one of these values: '2 ( x + y )' The input, '2 ( x + y ) ', did not match any of the valid values.

2   Fail
f = '2(x + y + z)'; y = expandf(f); validatestring(y,{'2 ( x + y + z )'}) assert(isequal(y,'2 ( x + y + z )'),'Not that kind of expansion ;)')

Error using VisibleTest2 (line 3) Expected input to match one of these values: '2 ( x + y + z )' The input, '2 ( x + y + z ) ', did not match any of the valid values.