Created
May 3, 2021 18:04
-
-
Save rndD/46010ab4a3b57fb30820ba78ac07bad5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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