LeetCode 1790. Check if One String Swap Can Make Strings Equal in F#

URL

Check if One String Swap Can Make Strings Equal - LeetCode

Code

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

let areAlmostEqual (s1: string) (s2: string) : bool =
    let v = Seq.zip s1 s2 |> Seq.filter (fun (c1, c2) -> c1 <> c2) |> Seq.toList

    match v with
    | [] -> true
    | _ :: [] -> false
    | (a1, a2) :: (b1, b2) :: [] when a1 = b2 && a2 = b1 -> true
    | _ -> false