LeetCode 796. Rotate String in F#

URL

https://leetcode.com/problems/rotate-string/description/

Code

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

let rotateString (s: string) (goal: string) : bool =
    if s.Length <> goal.Length then
        false
    else
        let len = s.Length
        let limit = len - 1

        seq { 0..limit }
        |> Seq.exists (fun i -> seq { 0..limit } |> Seq.forall (fun j -> s.[j] = goal.[(j + i) % len]))