LeetCode 567. Permutation in String in F#

URL

https://leetcode.com/problems/permutation-in-string/description/?envType=daily-question&envId=2024-10-05

Code

https://github.com/syohex/dotnet-study/blob/master/fsharp/leetcode/challenge/202410/permutation_in_string/main.fsx

let checkInclusion (s1: string) (s2: string) : bool =
    let table = s1 |> Seq.countBy id |> Seq.sort |> Seq.toList

    s2
    |> Seq.windowed s1.Length
    |> Seq.map (Seq.countBy id >> Seq.sort >> Seq.toList)
    |> Seq.contains table