Class Solution
java.lang.Object
g1201_1300.s1233_remove_sub_folders_from_the_filesystem.Solution
1233 - Remove Sub-Folders from the Filesystem.<p>Medium</p>
<p>Given a list of folders <code>folder</code>, return <em>the folders after removing all <strong>sub-folders</strong> in those folders</em>. You may return the answer in <strong>any order</strong>.</p>
<p>If a <code>folder[i]</code> is located within another <code>folder[j]</code>, it is called a <strong>sub-folder</strong> of it.</p>
<p>The format of a path is one or more concatenated strings of the form: <code>'/'</code> followed by one or more lowercase English letters.</p>
<ul>
<li>For example, <code>"/leetcode"</code> and <code>"/leetcode/problems"</code> are valid paths while an empty string and <code>"/"</code> are not.</li>
</ul>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> folder = [“/a”,“/a/b”,“/c/d”,“/c/d/e”,“/c/f”]</p>
<p><strong>Output:</strong> [“/a”,“/c/d”,“/c/f”]</p>
<p><strong>Explanation:</strong> Folders “/a/b” is a subfolder of “/a” and “/c/d/e” is inside of folder “/c/d” in our filesystem.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> folder = [“/a”,“/a/b/c”,“/a/b/d”]</p>
<p><strong>Output:</strong> [“/a”]</p>
<p><strong>Explanation:</strong> Folders “/a/b/c” and “/a/b/d” will be removed because they are subfolders of “/a”.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> folder = [“/a/b/c”,“/a/b/ca”,“/a/b/d”]</p>
<p><strong>Output:</strong> [“/a/b/c”,“/a/b/ca”,“/a/b/d”]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= folder.length <= 4 * 10<sup>4</sup></code></li>
<li><code>2 <= folder[i].length <= 100</code></li>
<li><code>folder[i]</code> contains only lowercase letters and <code>'/'</code>.</li>
<li><code>folder[i]</code> always starts with the character <code>'/'</code>.</li>
<li>Each folder name is <strong>unique</strong>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
removeSubfolders
-