LeetCode 2433. Find The Original Array of Prefix Xor in F#

URL

Find The Original Array of Prefix Xor - LeetCode

Code

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

let findArray (pref: int list) : int list =
    let head = List.head pref

    List.tail pref
    |> List.fold
        (fun (ret, acc) n ->
            let m = acc ^^^ n
            m :: ret, acc ^^^ m)
        ([ head ], head)
    |> fst
    |> List.rev