We are given a string as a file path like this:
"dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext". This string means directory structure below.
We answer a number of max length of file path like this: 20 (number of length about
How to Solve
\t means depth of directory or file. Using Stack, we can control length of file path and depth of directory or file.
- Number of stack size and number of depth of directory or file are equivalent
- In case of that same depth directories or files continue, we pop value from stack in oder to find out parent directory.