LeetCode 1598. Crawler Log Folder in F#
URL
Code
let minOperations (logs: string list) : int =
let rec minOperations' logs depth =
match logs with
| [] -> depth
| h :: t ->
match h with
| "../" -> minOperations' t (if depth > 0 then depth - 1 else 0)
| "./" -> minOperations' t depth
| _ -> minOperations' t (depth + 1)
minOperations' logs 0