Shohei Yoshida
Shohei Yoshida's Blog

Follow

Shohei Yoshida's Blog

Follow

LeetCode 944. Delete Columns to Make Sorted in F#

Shohei Yoshida's photo
Shohei Yoshida
·Jan 3, 2023·

1 min read

URL

https://leetcode.com/problems/delete-columns-to-make-sorted/description/

Code

https://github.com/syohex/dotnet-study/blob/master/fsharp/leetcode/problems/0944/main.fsx

let minDeletionSize (strs: string list) : int =
    seq { 0 .. (strs.Head.Length - 1) }
    |> Seq.map (fun i -> strs |> List.map (fun s -> s.[i]))
    |> Seq.filter (fun cs -> cs <> List.sort cs)
    |> Seq.length
 
Share this