LeetCode 58. Length of Last Word in F#
URL
https://leetcode.com/problems/length-of-last-word/description/
Code
let lengthOfLastWord (s: string) : int =
s.TrimEnd()
|> Seq.rev
|> Seq.tryFindIndex ((=) ' ')
|> Option.defaultValue s.Length