LeetCode 1456. Maximum Number of Vowels in a Substring of Given Length in F#
URL
https://leetcode.com/problems/maximum-number-of-vowels-in-a-substring-of-given-length/description/
Code
https://github.com/syohex/dotnet-study/blob/master/fsharp/leetcode/problems/1456/main.fsx
let maxVowels (s: string) (k: int) : int =
let isVowel (c: char) : bool =
c = 'a' || c = 'e' || c = 'i' || c = 'o' || c = 'u'
s
|> Seq.windowed k
|> Seq.map (fun w -> Seq.filter isVowel w |> Seq.length)
|> Seq.max