Skip to content

Instantly share code, notes, and snippets.

@jeremyabbott
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyabbott/3ba3382b5f7ccb809a90 to your computer and use it in GitHub Desktop.
Save jeremyabbott/3ba3382b5f7ccb809a90 to your computer and use it in GitHub Desktop.
let findDuplicateLetter list =
let rec findDuplicate list item =
match list with
| [] -> "No duplicates were found"
| x::xs when item = x -> x
| x::xs -> findDuplicate xs x
findDuplicate (List.sort list) ""
[<EntryPoint>]
let main argv =
printfn "%s" (findDuplicateLetter ["a";"b";"c"])
printfn "%s" (findDuplicateLetter ["a";"a";"b";"c"])
printfn "%s" (findDuplicateLetter ["a";"b";"b";"c"])
printfn "%s" (findDuplicateLetter ["a";"b";"c";"c"])
0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment