Crawler Log Folder LeetCode solution in Java

1
class Solution {
2
public int minOperations(String[] logs) {
3
var stack = new Stack<String>();
4
for (var log : logs) {
5
if (log.equals("../")) {
6
if (!stack.empty()) stack.pop();
7
} else if (log.equals("./")) {
8

9
} else {
10
stack.push(log);
11
}
12
}
13
return stack.size();
14
}
15
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0