LeetCode 2390. Removing Stars From a String in F#
URL
Removing Stars From a String - LeetCode
Code
https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/problems/2390/main.fsx
open System
let removeStars (s: string) : string =
let rec removeStars' (cs: char list) acc =
match cs with
| [] -> acc |> List.rev |> List.toArray |> String
| h :: t ->
if h = '*' then
removeStars' t (List.tail acc)
else
removeStars' t (h :: acc)
removeStars' (Seq.toList s) []