Exercism v3 launches on Sept 1st 2021.
Learn more!
ðŸš€ðŸš€ðŸš€
Sign up
Log in
Home
Language tracks
C++ track
Exercises
Exercises on the C++ track
Join the C++ Track
55 exercises to help you master C++
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
strings
easy
Isogram
Determine if a word or phrase is an isogram.
strings
conditionals
loops
easy
Leap
Given a year, report if it is a leap year.
logic
conditionals
easy
Reverse String
Reverse a string
strings
easy
Gigasecond
Given a moment, determine the moment that would be after a gigasecond has passed.
dates
interfaces
easy
Hamming
Calculate the Hamming difference between two DNA strands.
strings
loops
medium
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
parsing
strings
conditionals
medium
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
arrays
filtering
strings
easy
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
arrays
maps
loops
medium
Word Count
Given a phrase, count the occurrences of each word in that phrase.
arrays
maps
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.
math
loops
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
parsing
strings
medium
Food Chain
Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'
pattern recognition
strings
loops
medium
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
parsing
strings
easy
Grade School
Given students' names along with the grade that they are in, create a roster for the school
arrays
parsing
medium
Robot Name
Manage robot factory settings.
randomness
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.
math
easy
Space Age
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
functions
medium
Meetup
Calculate the date of meetups.
functions
interfaces
easy
Scrabble Score
Given a word, compute the Scrabble score for that word.
maps
strings
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
conditionals
easy
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
bitwise operations
easy
Raindrops
Convert a number to a string, the content of which depends on the number's factors.
strings
medium
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
strings
easy
Binary
Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles
strings
math
medium
Prime Factors
Compute the prime factors of a given natural number.
math
loops
easy
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
arrays
math
medium
Crypto Square
Implement the classic method for composing secret messages called a square code.
filtering
strings
text formatting
easy
Trinary
Convert a trinary number, represented as a string (e.g. '102012'), to its decimal equivalent using first principles.
strings
math
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
strings
easy
Acronym
Convert a long phrase to its acronym
regular expressions
strings
hard
Say
Given a number from 0 to 999,999,999,999, spell out that number in English.
logic
strings
text formatting
medium
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
math
loops
medium
Series
Given a string of digits, output all the contiguous substrings of length `n` in that string.
arrays
logic
strings
medium
Robot Simulator
Write a robot simulator.
classes
conditionals
strings
variables
pairs
loops
medium
Clock
Implement a clock that handles times without dates.
classes
time
medium
Beer Song
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
strings
text formatting
medium
Nth Prime
Given a number n, determine what the nth prime is.
math
easy
Hexadecimal
Convert a hexadecimal number, represented as a string (e.g. "10af8c"), to its decimal equivalent using first principles (i.e. no, you may not use built-in or external libraries to accomplish the conversion).
strings
math
medium
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.
logic
loops
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
filtering
easy
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
algorithms
strings
easy
Matching Brackets
Make sure the brackets and braces all match.
pattern matching
stacks
easy
Pangram
Determine if a sentence is a pangram.
strings
loops
medium
Binary Search
Implement a binary search algorithm.
arrays
searching
conditionals
loops
hard
Binary Search Tree
Insert and search for numbers in a binary tree.
algorithms
classes
medium
All Your Base
Convert a number, represented as a sequence of digits in one base, to any other base.
algorithms
integers
loops
math
medium
Complex Numbers
Implement complex numbers.
classes
operator overloading
math
easy
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
math
strings
easy
Armstrong Numbers
Determine if a number is an Armstrong number
loops
math
algorithms
medium
Circular Buffer
A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.
classes
algorithms
data structures
easy
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
functions
math
easy
Secret Handshake
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
arrays
bitwise operations
easy
Protein Translation
Translate RNA sequences into proteins.
filtering
maps
sequences
easy
Two Fer
Create a sentence of the form "One for X, one for me."
optional values
strings
text formatting