Shohei Yoshida
Shohei Yoshida's Blog

Shohei Yoshida's Blog

LeetCode 557. Reverse Words in a String III in F#

Shohei Yoshida's photo
Shohei Yoshida
·Sep 22, 2022·

1 min read

URL

leetcode.com/problems/reverse-words-in-a-st..

Code

github.com/syohex/dotnet-study/blob/master/..

let reverseString (s: string) : string =
    s.Split([| ' ' |])
    |> Array.map (fun s -> s.ToCharArray() |> Array.rev)
    |> Array.map System.String
    |> String.concat " "
 
Share this