Skip to content

Commit 4d17aa0

Browse files
authored
Create 1598. Crawler Log Folder (#525)
2 parents 8a5e021 + c867c95 commit 4d17aa0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

1598. Crawler Log Folder

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public:
3+
int minOperations(vector<string>& logs) {
4+
int folderDepth = 0;
5+
6+
for (const string& log : logs) {
7+
if (log == "../") {
8+
if (folderDepth > 0) folderDepth--;
9+
}
10+
else if (log != "./") {
11+
folderDepth++;
12+
}
13+
}
14+
15+
return folderDepth;
16+
}
17+
};

0 commit comments

Comments
 (0)