LeetCode 2161. Partition Array According to Given Pivot in F#
Today's daily problem is not suit for F# so I solved another problem.
URL
leetcode.com/problems/partition-array-accor..
Code
github.com/syohex/dotnet-study/blob/master/..
let pivotArray (nums: int list) (pivot: int) : int list =
let pivotCount =
nums |> List.filter ((=) pivot) |> List.length
let lows = nums |> List.filter (fun n -> n < pivot)
let highs = nums |> List.filter (fun n -> n > pivot)
let pivots = List.init pivotCount (fun _ -> pivot)
lows @ pivots @ highs