Given a string consisting of closed parentheses, form a string array in the following way so that the orders of these parentheses are visually apparent.

Example:

str = '(()(()(()(()))))';
out =  {'(              )';
        ' ()(          ) ';
        '    ()(      )  ';
        '       ()(  )   ';
        '          ()    '}

For more information, please check the test suite.

Solution Stats

322 Solutions

52 Solvers

Last Solution submitted on Mar 29, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers52

Suggested Problems

More from this Author44

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!