1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 17:56:55 +02:00

go: add «1598. Crawler Log Folder»

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-07-10 10:06:31 +02:00
parent 8198249ac5
commit 5f3765f37a
Signed by: mfocko
SSH key fingerprint: SHA256:5YXD7WbPuK60gxnG6DjAwJiS9+swoWj33/HFu8g8JVo

17
go/crawler-log-folder.go Normal file
View file

@ -0,0 +1,17 @@
package main
func minOperations(logs []string) int {
depth := 0
for _, dir := range logs {
if dir == "../" {
depth = max(0, depth-1)
} else if dir == "./" {
/* no-op */
} else {
depth++
}
}
return depth
}