mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-09 15:59:06 +01:00
17 lines
229 B
Go
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
|
|
}
|