mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 13:36:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>假设有一个同时存储文件和目录的文件系统。下图展示了文件系统的一个示例:</p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/28/mdir.jpg\" style=\"height: 142px; width: 300px;\" /></p>\n\n<p>这里将 <code>dir</code> 作为根目录中的唯一目录。<code>dir</code> 包含两个子目录 <code>subdir1</code> 和 <code>subdir2</code> 。<code>subdir1</code> 包含文件 <code>file1.ext</code> 和子目录 <code>subsubdir1</code>;<code>subdir2</code> 包含子目录 <code>subsubdir2</code>,该子目录下包含文件 <code>file2.ext</code> 。</p>\n\n<p>在文本格式中,如下所示(⟶表示制表符):</p>\n\n<pre>\ndir\n⟶ subdir1\n⟶ ⟶ file1.ext\n⟶ ⟶ subsubdir1\n⟶ subdir2\n⟶ ⟶ subsubdir2\n⟶ ⟶ ⟶ file2.ext\n</pre>\n\n<p>如果是代码表示,上面的文件系统可以写为 <code>\"dir\\n\\tsubdir1\\n\\t\\tfile1.ext\\n\\t\\tsubsubdir1\\n\\tsubdir2\\n\\t\\tsubsubdir2\\n\\t\\t\\tfile2.ext\"</code> 。<code>'\\n'</code> 和 <code>'\\t'</code> 分别是换行符和制表符。</p>\n\n<p>文件系统中的每个文件和文件夹都有一个唯一的 <strong>绝对路径</strong> ,即必须打开才能到达文件/目录所在位置的目录顺序,所有路径用 <code>'/'</code> 连接。上面例子中,指向 <code>file2.ext</code> 的 <strong>绝对路径</strong> 是 <code>\"dir/subdir2/subsubdir2/file2.ext\"</code> 。每个目录名由字母、数字和/或空格组成,每个文件名遵循 <code>name.extension</code> 的格式,其中<meta charset=\"UTF-8\" /> <code>name</code> 和<meta charset=\"UTF-8\" /> <code>extension</code>由字母、数字和/或空格组成。</p>\n\n<p>给定一个以上述格式表示文件系统的字符串 <code>input</code> ,返回文件系统中 <em>指向 <strong>文件</strong> 的 <strong>最长绝对路径</strong> 的长度</em> 。 如果系统中没有文件,返回 <code>0</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/28/dir1.jpg\" style=\"height: 101px; width: 200px;\" />\n<pre>\n<strong>输入:</strong>input = \"dir\\n\\tsubdir1\\n\\tsubdir2\\n\\t\\tfile.ext\"\n<strong>输出:</strong>20\n<strong>解释:</strong>只有一个文件,绝对路径为 \"dir/subdir2/file.ext\" ,路径长度 20\n</pre>\n\n<p><strong>示例 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/28/dir2.jpg\" style=\"height: 151px; width: 300px;\" />\n<pre>\n<strong>输入:</strong>input = \"dir\\n\\tsubdir1\\n\\t\\tfile1.ext\\n\\t\\tsubsubdir1\\n\\tsubdir2\\n\\t\\tsubsubdir2\\n\\t\\t\\tfile2.ext\"\n<strong>输出:</strong>32\n<strong>解释:</strong>存在两个文件:\n\"dir/subdir1/file1.ext\" ,路径长度 21\n\"dir/subdir2/subsubdir2/file2.ext\" ,路径长度 32\n返回 32 ,因为这是最长的路径</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>input = \"a\"\n<strong>输出:</strong>0\n<strong>解释:</strong>不存在任何文件</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>input = \"file1.txt\\nfile2.txt\\nlongfile.txt\"\n<strong>输出:</strong>12\n<strong>解释:</strong>根目录下有 3 个文件。\n因为根目录中任何东西的绝对路径只是名称本身,所以答案是 \"longfile.txt\" ,路径长度为 12\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= input.length <= 10<sup>4</sup></code></li>\n\t<li><code>input</code> 可能包含小写或大写的英文字母,一个换行符 <code>'\\n'</code>,一个制表符 <code>'\\t'</code>,一个点 <code>'.'</code>,一个空格 <code>' '</code>,和数字。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 125,
|
||||
"likes": 225,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.2K\", \"totalSubmission\": \"15.2K\", \"totalAcceptedRaw\": 8227, \"totalSubmissionRaw\": 15250, \"acRate\": \"53.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"29.3K\", \"totalSubmission\": \"45.8K\", \"totalAcceptedRaw\": 29327, \"totalSubmissionRaw\": 45755, \"acRate\": \"64.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user