Skip to content

Instantly share code, notes, and snippets.

@rndD
Created May 3, 2021 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rndD/46010ab4a3b57fb30820ba78ac07bad5 to your computer and use it in GitHub Desktop.
Save rndD/46010ab4a3b57fb30820ba78ac07bad5 to your computer and use it in GitHub Desktop.
func minOperations(logs []string) int {
deep := 0
for _, log := range logs {
if log == "./" {
continue
}
if log == "../" {
if deep != 0 {
deep = deep - 1
}
} else {
deep = deep + 1
}
}
return deep
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment