Sign up
Log in
Home
Language tracks
Common Lisp track
Exercises
Exercises on the Common Lisp track
Join the Common Lisp Track
42 exercises to help you master Common Lisp
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
optional values
text formatting
easy
Hamming
Calculate the Hamming difference between two DNA strands.
control flow conditionals
control flow loops
equality
filtering
strings
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
control flow conditionals
strings
transforming
easy
Leap
Given a year, report if it is a leap year.
control flow conditionals
equality
integers
logic
easy
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
equality
filtering
strings
easy
Beer Song
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
control flow conditionals
control flow loops
integers
text formatting
easy
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
control flow conditionals
control flow loops
integers
strings
text formatting
easy
Word Count
Given a phrase, count the occurrences of each word in that phrase.
control flow conditionals
control flow loops
filtering
strings
easy
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
control flow conditionals
parsing
strings
medium
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
algorithms
strings
transforming
easy
All Your Base
Convert a number, represented as a sequence of digits in one base, to any other base.
integers
map
math
transforming
easy
Acronym
Convert a long phrase to its acronym
strings
transforming
medium
Twelve Days
Output the lyrics to 'The Twelve Days of Christmas'
algorithms
strings
easy
Sublist
Write a function to determine if a list is a sublist of another list.
lists
easy
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
integers
variables
easy
Gigasecond
Given a moment, determine the moment that would be after a gigasecond has passed.
date
integers
time
transforming
variables
easy
Robot Name
Manage robot factory settings.
randomness
strings
variables
easy
Raindrops
Convert a number to a string, the content of which depends on the number's factors.
control flow conditionals
filtering
integers
easy
Grade School
Given students' names along with the grade that they are in, create a roster for the school
interfaces
lists
maps
sorting
variables
easy
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
interfaces
parsing
strings
easy
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
control flow loops
maps
transforming
easy
Space Age
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
floating point numbers
interfaces
transforming
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
control flow loops
maps
sorting
strings
easy
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
integer
recursivity
math
easy
Perfect Numbers
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
number theory
math
easy
Isogram
Determine if a word or phrase is an isogram.
strings
easy
Meetup
Calculate the date of meetups.
control flow conditionals
dates
filtering
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
control flow conditionals
filtering
floating point numbers
integers
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 loops
floating point numbers
integers
math
easy
Scrabble Score
Given a word, compute the Scrabble score for that word.
control flow loops
games
maps
strings
easy
Binary
Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles
bitwise operations
control flow conditionals
integers
math
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
control flow conditionals
integers
text formatting
easy
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
control flow conditionals
control flow loops
filtering
integers
maps
math
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.
control flow conditionals
control flow loops
filtering
sequences
easy
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
control flow conditionals
control flow loops
sequences
transforming
easy
Prime Factors
Compute the prime factors of a given natural number.
control flow conditionals
control flow loops
filtering
integers
maps
math
easy
Crypto Square
Implement the classic method for composing secret messages called a square code.
arrays
control flow conditionals
control flow loops
strings
transforming
easy
Trinary
Convert a trinary number, represented as a string (e.g. '102012'), to its decimal equivalent using first principles.
control flow conditionals
integers
math
easy
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
control flow loops
integers
sequences
math
easy
Armstrong Numbers
Determine if a number is an Armstrong number
integers
lists
math
easy
Robot Simulator
Write a robot simulator.
misc