LeetCode 1408. String Matching in an Array in F#
URL
Code
let stringMatching (words: string list) : string list =
let words = List.indexed words
words
|> List.fold
(fun acc (i, word) ->
match List.tryFind (fun (j, (w: string)) -> i <> j && w.Contains(word)) words with
| Some(_) -> word :: acc
| None -> acc)
[]