Problem 43320. Expand a term
Given a term, as a string, expand it.
e. g.
f = '2(x + y)';
Solution Stats
Problem Comments
-
2 Comments
Giovanni Mottola
on 10 Oct 2016
Nice idea, but the test cases are a bit confusing. Why do you add one space before and after '(', but none after ')' and three between the letters and the '+' symbol?
Marc Jakobi
on 14 Oct 2016
Thanks for the input :)
The reason I add one before '(' is because there is a '2' before it, which is part of the term. The ones between the letters and the '+' symbol are because spaces are characters, too.
Solution Comments
Show commentsProblem Recent Solvers36
Suggested Problems
-
6966 Solvers
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2530 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
13521 Solvers
-
Matlab Basics - Set unwanted parts of a vector to zero
259 Solvers
-
314 Solvers
More from this Author14
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!