Problem 2625. Shorten pathname

Given a pathname string, return a condensed version by replacing intermediate folders with '..'.

Example

If

fullpath = 'C:\foo\bar\baz\qux';

then

shortpath = 'C:\..\qux';

Solution Stats

50.51% Correct | 49.49% Incorrect
Last Solution submitted on Jan 05, 2026

Problem Comments

Solution Comments

Show comments


Problem Recent Solvers87

Problem Tags

Community Treasure Hunt

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

Start Hunting!