Exercism v3 launches on Sept 1st 2021.
Learn more!
ðŸš€ðŸš€ðŸš€
Sign up
Log in
Home
Language tracks
OCaml track
Exercises
Exercises on the OCaml track
Join the OCaml Track
44 exercises to help you master OCaml
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
setting up ocaml dev environment
strings
easy
Leap
Given a year, report if it is a leap year.
booleans
integers
easy
Hamming
Calculate the Hamming difference between two DNA strands.
iterating over two lists at once
easy
Raindrops
Convert a number to a string, the content of which depends on the number's factors.
misc
easy
Difference Of Squares
Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
math
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
transforming
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
counting
easy
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
transforming
easy
Grade School
Given students' names along with the grade that they are in, create a roster for the school
transforming
easy
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
strings
easy
Allergies
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
bitwise operations
easy
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
strings
easy
Space Age
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
floats
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
misc
easy
Pangram
Determine if a sentence is a pangram.
strings
easy
Acronym
Convert a long phrase to its acronym
strings
medium
All Your Base
Convert a number, represented as a sequence of digits in one base, to any other base.
math
medium
Matching Brackets
Make sure the brackets and braces all match.
stacks
medium
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
misc
medium
Binary Search
Implement a binary search algorithm.
algorithms
arrays
search
medium
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
strings
medium
Word Count
Given a phrase, count the occurrences of each word in that phrase.
counting
strings
medium
Beer Song
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
strings
medium
Run Length Encoding
Implement run-length encoding and decoding.
algorithms
transforming
medium
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
strings
medium
Prime Factors
Compute the prime factors of a given natural number.
algorithms
math
medium
Say
Given a number from 0 to 999,999,999,999, spell out that number in English.
strings
medium
Palindrome Products
Detect palindrome products in a given range.
math
medium
Robot Name
Manage robot factory settings.
mutable state
randomness
medium
Change
Correctly determine change to be given using the least number of coins
algorithms
dynamic programming
medium
Rectangles
Count the rectangles in an ASCII diagram.
search
medium
List Ops
Implement basic list operations
functional programming
medium
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
transforming
medium
Minesweeper
Add the numbers to a minesweeper board
arrays
transforming
medium
Bowling
Score a bowling game
algorithms
medium
Dominoes
Make a chain of dominoes.
algorithms
search
hard
Custom Set
Create a custom set type.
functional programming
hard
Connect
Compute the result for a game of Hex / Polygon
search
hard
Meetup
Calculate the date of meetups.
dates
hard
Forth
Implement an evaluator for a very simple subset of Forth
interpreters
hard
Zipper
Creating a zipper for a binary tree.
functional programming
hard
React
Implement a basic reactive system.
reactive programming
hard
Hangman
Implement the logic of the hangman game using functional reactive programming.
reactive programming
easy
Binary Search Tree
Insert and search for numbers in a binary tree.
recursion
searching
trees