Skip to content

Commit 9a9f34b

Browse files
committed
Create README - LeetHub
1 parent 8c0b70a commit 9a9f34b

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

1598-crawler-log-folder/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<h2><a href="https://leetcode.com/problems/crawler-log-folder">1598. Crawler Log Folder</a></h2><h3>Easy</h3><hr><p>The Leetcode file system keeps a log each time some user performs a <em>change folder</em> operation.</p>
2+
3+
<p>The operations are described below:</p>
4+
5+
<ul>
6+
<li><code>&quot;../&quot;</code> : Move to the parent folder of the current folder. (If you are already in the main folder, <strong>remain in the same folder</strong>).</li>
7+
<li><code>&quot;./&quot;</code> : Remain in the same folder.</li>
8+
<li><code>&quot;x/&quot;</code> : Move to the child folder named <code>x</code> (This folder is <strong>guaranteed to always exist</strong>).</li>
9+
</ul>
10+
11+
<p>You are given a list of strings <code>logs</code> where <code>logs[i]</code> is the operation performed by the user at the <code>i<sup>th</sup></code> step.</p>
12+
13+
<p>The file system starts in the main folder, then the operations in <code>logs</code> are performed.</p>
14+
15+
<p>Return <em>the minimum number of operations needed to go back to the main folder after the change folder operations.</em></p>
16+
17+
<p>&nbsp;</p>
18+
<p><strong class="example">Example 1:</strong></p>
19+
20+
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/09/09/sample_11_1957.png" style="width: 775px; height: 151px;" /></p>
21+
22+
<pre>
23+
<strong>Input:</strong> logs = [&quot;d1/&quot;,&quot;d2/&quot;,&quot;../&quot;,&quot;d21/&quot;,&quot;./&quot;]
24+
<strong>Output:</strong> 2
25+
<strong>Explanation: </strong>Use this change folder operation &quot;../&quot; 2 times and go back to the main folder.
26+
</pre>
27+
28+
<p><strong class="example">Example 2:</strong></p>
29+
30+
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/09/09/sample_22_1957.png" style="width: 600px; height: 270px;" /></p>
31+
32+
<pre>
33+
<strong>Input:</strong> logs = [&quot;d1/&quot;,&quot;d2/&quot;,&quot;./&quot;,&quot;d3/&quot;,&quot;../&quot;,&quot;d31/&quot;]
34+
<strong>Output:</strong> 3
35+
</pre>
36+
37+
<p><strong class="example">Example 3:</strong></p>
38+
39+
<pre>
40+
<strong>Input:</strong> logs = [&quot;d1/&quot;,&quot;../&quot;,&quot;../&quot;,&quot;../&quot;]
41+
<strong>Output:</strong> 0
42+
</pre>
43+
44+
<p>&nbsp;</p>
45+
<p><strong>Constraints:</strong></p>
46+
47+
<ul>
48+
<li><code>1 &lt;= logs.length &lt;= 10<sup>3</sup></code></li>
49+
<li><code>2 &lt;= logs[i].length &lt;= 10</code></li>
50+
<li><code>logs[i]</code> contains lowercase English letters, digits, <code>&#39;.&#39;</code>, and <code>&#39;/&#39;</code>.</li>
51+
<li><code>logs[i]</code> follows the format described in the statement.</li>
52+
<li>Folder names consist of lowercase English letters and digits.</li>
53+
</ul>

0 commit comments

Comments
 (0)