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
}