go: add «1598. Crawler Log Folder»
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
8198249ac5
commit
5f3765f37a
1 changed files with 17 additions and 0 deletions
17
go/crawler-log-folder.go
Normal file
17
go/crawler-log-folder.go
Normal 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
|
||||||
|
}
|
Loading…
Reference in a new issue