Skip to content

Commit 449dc25

Browse files
add 1598
1 parent d872e02 commit 449dc25

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1598|[Crawler Log Folder](https://leetcode.com/problems/crawler-log-folder/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1598.java) ||Easy|Stack|
1112
|1592|[Rearrange Spaces Between Words](https://leetcode.com/problems/rearrange-spaces-between-words/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1592.java) ||Easy|String|
1213
|1588|[Sum of All Odd Length Subarrays](https://leetcode.com/problems/sum-of-all-odd-length-subarrays/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1588.java) ||Easy|Array|
1314
|1583|[Count Unhappy Friends](https://leetcode.com/problems/count-unhappy-friends/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1583.java) ||Medium|Array|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1598 {
4+
public static class Solution1 {
5+
public int minOperations(String[] logs) {
6+
int steps = 0;
7+
for (String log : logs) {
8+
if (log.equals("../")) {
9+
if (steps > 0) {
10+
steps--;
11+
}
12+
} else if (log.equals("./")) {
13+
//do nothing
14+
} else {
15+
steps++;
16+
}
17+
}
18+
return steps;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)