Sign up
Log in
Home
Language tracks
Erlang track
Exercises
Exercises on the Erlang track
Join the Erlang Track
73 exercises to help you master Erlang
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
strings
easy
Two Fer
Create a sentence of the form "One for X, one for me."
strings
arity
easy
Leap
Given a year, report if it is a leap year.
control flow conditionals
logic
easy
Accumulate
Implement the `accumulate` operation, which, given a collection and an operation to perform on each element of the collection, returns a new collection containing the result of applying that operation to each element of the input collection.
lists
easy
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
control flow conditionals
pattern matching
math
easy
Raindrops
Convert a number to a string, the content of which depends on the number's factors.
control flow conditionals
pattern matching
strings
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
control flow conditionals
pattern matching
strings
easy
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
pattern matching
strings
easy
Strain
Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.
lists
control flow conditionals
easy
Hamming
Calculate the Hamming difference between two DNA strands.
strings
easy
Space Age
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
time
easy
Darts
Write a function that returns the earned points in a single toss of a Darts game
control flow conditionals
math
easy
Secret Handshake
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
control flow conditionals
pattern matching
strings
easy
Queen Attack
Given the position of two queens on a chess board, indicate whether or not they are positioned so that they can attack each other.
control flow conditionals
logic
easy
Diamond
Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.
lists
strings
easy
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
bitwise operations
pattern matching
easy
Isogram
Determine if a word or phrase is an isogram.
control flow conditionals
pattern matching
strings
easy
Pangram
Determine if a sentence is a pangram.
control flow conditionals
control flow recursion
strings
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
parsing
strings
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.
control flow recursion
pattern matching
math
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
control flow conditionals
easy
Prime Factors
Compute the prime factors of a given natural number.
math
easy
Sum Of Multiples
Given a number, find the sum of all the multiples of particular numbers up to but not including that number.
math
easy
Perfect Numbers
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
integers
math
easy
Armstrong Numbers
Determine if a number is an Armstrong number
integers
math
easy
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
lists
filtering
strings
easy
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
algorithms
strings
easy
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
parsing
strings
easy
ISBN Verifier
Check if a given string is a valid ISBN-10 number.
algorithms
easy
Bracket Push
misc
easy
Gigasecond
Given a moment, determine the moment that would be after a gigasecond has passed.
dates
easy
Scrabble Score
Given a word, compute the scrabble score for that word.
pattern matching
strings
easy
Run Length Encoding
Implement run-length encoding and decoding.
strings
easy
Protein Translation
Translate RNA sequences into proteins.
control flow conditionals
pattern matching
strings
medium
Robot Simulator
Write a robot simulator.
algorithms
control flow conditionals
control flow recursion
medium
Grade School
Given students' names along with the grade that they are in, create a roster for the school
pattern matching
medium
Sublist
Write a function to determine if a list is a sublist of another list.
lists
sequences
medium
Word Count
Given a phrase, count the occurrences of each word in that phrase.
lists
maps
strings
medium
Clock
Implement a clock that handles times without dates.
control flow conditionals
time
medium
Allergies
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
algorithms
bitwise operations
medium
Transpose
Take input text and output it transposed.
algorithms
transforming
medium
All Your Base
Convert a number, represented as a sequence of digits in one base, to any other base.
math
medium
Series
Given a string of digits, output all the contiguous substrings of length `n` in that string.
strings
medium
Parallel Letter Frequency
Count the frequency of letters in texts using parallel computation.
pattern matching
strings
medium
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
pattern matching
strings
medium
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
filtering
math
medium
Saddle Points
Detect saddle points in a matrix.
matrices
medium
Largest Series Product
Given a string of digits, calculate the largest product for a contiguous substring of digits of length n.
strings
math
medium
Rational Numbers
Implement rational numbers.
math
medium
Complex Numbers
Implement complex numbers.
parsing
strings
math
medium
Rotational Cipher
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
algorithms
strings
medium
Change
Correctly determine change to be given using the least number of coins
algorithms
medium
Variable Length Quantity
Implement variable length quantity encoding and decoding.
bitwise operations
integers
transforming
medium
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
algorithms
maps
strings
medium
Bank Account
Simulate a bank account supporting opening/closing, withdraws, and deposits of money. Watch out for concurrent transactions!
algorithms
functions
pattern matching
medium
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
algorithms
medium
Pythagorean Triplet
There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.
algorithms
math
medium
Custom Set
Create a custom set type.
types
medium
Meetup
Calculate the date of meetups.
control flow conditionals
dates
medium
Crypto Square
Implement the classic method for composing secret messages called a square code.
cryptography
strings
medium
Rail Fence Cipher
Implement encoding and decoding for the rail fence cipher.
cryptography
strings
medium
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
pattern matching
strings
math
medium
Palindrome Products
Detect palindrome products in a given range.
algorithms
math
performance
medium
Poker
Pick the best hand(s) from a list of poker hands.
algorithms
strings
medium
Forth
Implement an evaluator for a very simple subset of Forth
algorithms
parsing
strings
medium
Circular Buffer
A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.
algorithms
types
medium
Minesweeper
Add the numbers to a minesweeper board
lists
parsing
strings
transforming
medium
Beer Song
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
strings
text formatting
hard
Dominoes
Make a chain of dominoes.
algorithms
hard
Zipper
Creating a zipper for a binary tree.
algorithms
control flow recursion
types
hard
Spiral Matrix
Given the size, return a square matrix of numbers in spiral order.
algorithms
hard
Connect
Compute the result for a game of Hex / Polygon
algorithms
games
parsing
easy
List Ops
Implement basic list operations
lists