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