Last active
August 29, 2015 14:24
-
-
Save jeremyabbott/3ba3382b5f7ccb809a90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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