LeetCode 1598. Crawler Log Folder in F#

URL

Crawler Log Folder - LeetCode

Code

https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/challenge/202407/crawler_log_folder/main.fsx

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