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.
equality
filtering
strings
conditionals
loops
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
strings
transforming
conditionals
easy
Leap
Given a year, report if it is a leap year.
equality
integers
logic
conditionals
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.
integers
text formatting
conditionals
loops
easy
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
integers
strings
text formatting
conditionals
loops
easy
Word Count
Given a phrase, count the occurrences of each word in that phrase.
filtering
strings
conditionals
loops
easy
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
parsing
strings
conditionals
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
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.
integers
time
transforming
variables
dates
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.
filtering
integers
conditionals
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.
maps
transforming
loops
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.
maps
sorting
strings
loops
easy
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
math
integers
recursion
easy
Perfect Numbers
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
math
easy
Isogram
Determine if a word or phrase is an isogram.
strings
easy
Meetup
Calculate the date of meetups.
dates
filtering
conditionals
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
filtering
floating point numbers
integers
conditionals
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.
floating point numbers
integers
math
loops
easy
Scrabble Score
Given a word, compute the Scrabble score for that word.
games
maps
strings
loops
easy
Binary
Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles
bitwise operations
integers
math
conditionals
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
integers
text formatting
conditionals
easy
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
filtering
integers
maps
math
conditionals
loops
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.
filtering
sequences
conditionals
loops
easy
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
sequences
transforming
conditionals
loops
easy
Prime Factors
Compute the prime factors of a given natural number.
filtering
integers
maps
math
conditionals
loops
easy
Crypto Square
Implement the classic method for composing secret messages called a square code.
arrays
strings
transforming
conditionals
loops
easy
Trinary
Convert a trinary number, represented as a string (e.g. '102012'), to its decimal equivalent using first principles.
integers
math
conditionals
easy
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
integers
sequences
math
loops
easy
Armstrong Numbers
Determine if a number is an Armstrong number
integers
lists
math
easy
Robot Simulator
Write a robot simulator.
loops
sequences
strings