Exercism v3 launches on Sept 1st 2021.
Learn more!
ðŸš€ðŸš€ðŸš€
Sign up
Log in
Home
Language tracks
Nim track
Exercises
Exercises on the Nim track
Join the Nim Track
67 exercises to help you master Nim
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."
conditionals
optional values
text formatting
easy
Leap
Given a year, report if it is a leap year.
booleans
conditionals
logic
easy
Reverse String
Reverse a string
strings
easy
Isogram
Determine if a word or phrase is an isogram.
algorithms
conditionals
loops
maps
strings
easy
Pangram
Determine if a sentence is a pangram.
algorithms
conditionals
filtering
logic
loops
strings
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
conditionals
logic
loops
maps
strings
transforming
easy
Hamming
Calculate the Hamming difference between two DNA strands.
algorithms
conditionals
filtering
logic
loops
sequences
sets
strings
easy
Word Count
Given a phrase, count the occurrences of each word in that phrase.
algorithms
logic
pattern recognition
strings
text formatting
easy
Gigasecond
Given a moment, determine the moment that would be after a gigasecond has passed.
dates
time
easy
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
conditionals
equality
strings
easy
Run Length Encoding
Implement run-length encoding and decoding.
algorithms
strings
text formatting
easy
Armstrong Numbers
Determine if a number is an Armstrong number
algorithms
loops
math
easy
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
integers
type conversion
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
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
algorithms
logic
parsing
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
classes
enumerations
easy
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
algorithms
conditionals
loops
strings
easy
Sum Of Multiples
Given a number, find the sum of all the multiples of particular numbers up to but not including that number.
integers
math
easy
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
loops
math
easy
Acronym
Convert a long phrase to its acronym
regular expressions
strings
easy
Grade School
Given students' names along with the grade that they are in, create a roster for the school
conditionals
filtering
integers
lists
sorting
strings
classes
easy
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
conditionals
integers
logic
loops
strings
easy
Space Age
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
conditionals
floating point numbers
integers
easy
Scrabble Score
Given a word, compute the Scrabble score for that word.
games
loops
maps
strings
easy
Nth Prime
Given a number n, determine what the nth prime is.
algorithms
lists
loops
math
easy
Matching Brackets
Make sure the brackets and braces all match.
parsing
recursion
stacks
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.
arrays
exception handling
games
logic
matrices
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
classes
conditionals
easy
All Your Base
Convert a number, represented as a sequence of digits in one base, to any other base.
math
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
maps
strings
easy
Raindrops
Convert a number to a string, the content of which depends on the number's factors.
conditionals
integers
strings
hard
React
Implement a basic reactive system.
callbacks
events
reactive programming
easy
Clock
Implement a clock that handles times without dates.
equality
text formatting
time
easy
Crypto Square
Implement the classic method for composing secret messages called a square code.
cryptography
strings
text formatting
transforming
easy
Darts
Write a function that returns the earned points in a single toss of a Darts game
conditionals
floating point numbers
math
easy
Diamond
Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.
strings
text formatting
easy
Diffie Hellman
Diffie-Hellman key exchange.
algorithms
cryptography
integers
math
randomness
easy
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
maps
transforming
easy
High Scores
Manage a player's High Score list
sequences
sorting
easy
ISBN Verifier
Check if a given string is a valid ISBN-10 number.
parsing
strings
type conversion
easy
Kindergarten Garden
Given a diagram, determine which plants each child in the kindergarten class is responsible for.
enumerations
parsing
strings
easy
Largest Series Product
Given a string of digits, calculate the largest product for a contiguous substring of digits of length n.
algorithms
integers
math
strings
easy
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
algorithms
integers
strings
easy
Matrix
Given a string representing a matrix of numbers, return the rows and columns of that matrix.
matrices
strings
easy
Meetup
Calculate the date of meetups.
dates
enumerations
transforming
easy
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
algorithms
math
easy
Perfect Numbers
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.
enumerations
filtering
integers
math
easy
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
conditionals
parsing
strings
easy
Prime Factors
Compute the prime factors of a given natural number.
integers
math
easy
Protein Translation
Translate RNA sequences into proteins.
maps
strings
easy
Proverb
For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Output the full text of this proverbial rhyme.
loops
strings
easy
Resistor Color
Convert a resistor band's color to its numeric representation
arrays
enumerations
easy
Resistor Color Duo
Convert color codes, as used on resistors, to a numeric value.
arrays
enumerations
transforming
easy
Resistor Color Trio
Convert color codes, as used on resistors, to a human-readable label.
arrays
enumerations
math
easy
Robot Name
Manage robot factory settings.
randomness
strings
easy
Rotational Cipher
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
cryptography
integers
strings
easy
Saddle Points
Detect saddle points in a matrix.
integers
matrices
searching
easy
Say
Given a number from 0 to 999,999,999,999, spell out that number in English.
integers
strings
text formatting
transforming
easy
Scale Generator
Generate musical scales, given a starting note and a set of intervals.
pattern matching
strings
easy
Secret Handshake
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
bitwise operations
conditionals
integers
lists
logic
loops
transforming
easy
Series
Given a string of digits, output all the contiguous substrings of length `n` in that string.
sequences
strings
transforming
easy
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
algorithms
filtering
integers
math
easy
Spiral Matrix
Given the size, return a square matrix of numbers in spiral order.
integers
matrices
easy
Sublist
Write a function to determine if a list is a sublist of another list.
enumerations
searching
sequences
easy
Twelve Days
Output the lyrics to 'The Twelve Days of Christmas'
pattern recognition
strings
text formatting
easy
Yacht
Score a single throw of dice in the game Yacht
conditionals
games
integers