Skip to content

Commit 22e56f7

Browse files
committed
Time: 9 ms (22.38%), Space: 14 MB (61.11%) - LeetHub
1 parent 9a9f34b commit 22e56f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public:
3+
int minOperations(vector<string>& logs) {
4+
int ans = 0;
5+
for (int i = 0; i < (int)logs.size(); i++) {
6+
if (logs[i] == "./") continue;
7+
else if (logs[i] == "../") ans--;
8+
else ans++;
9+
ans = max(0, ans);
10+
}
11+
return ans;
12+
}
13+
};

0 commit comments

Comments
 (0)