Cody

Problem 43320. Expand a term

Solution 2622037

Submitted on 27 Jun 2020
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 ;)')

y = 0×0 empty char array

Error using Test1 (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 ;)')

y = 0×0 empty char array

Error using Test2 (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.