1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-09 15:59:06 +01:00
LeetCode/go/crawler-log-folder.go
Matej Focko 5f3765f37a
go: add «1598. Crawler Log Folder»
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-07-10 10:06:31 +02:00

17 lines
229 B
Go

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
}