Sign up
Log in
Home
Language tracks
R track
Exercises
Exercises on the R track
Join the R Track
34 exercises to help you master R
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
optional values
text formatting
easy
Two Fer
Create a sentence of the form "One for X, one for me."
strings
easy
Leap
Given a year, report if it is a leap year.
booleans
integers
logic
easy
Hamming
Calculate the Hamming difference between two DNA strands.
filtering
strings
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
strings
transforming
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.
integers
math
easy
Raindrops
Convert a number to a string, the contents of which depend on the number's factors.
filtering
text formatting
easy
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
integers
easy
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
control flow conditionals
strings
easy
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
filtering
strings
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
easy
Sum Of Multiples
Given a number, find the sum of all the multiples of particular numbers up to but not including that number.
lists
math
easy
Word Count
Given a phrase, count the occurrences of each word in that phrase.
strings
transforming
easy
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
parsing
transforming
easy
Rotational Cipher
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
strings
easy
Scrabble Score
Given a word, compute the scrabble score for that word.
strings
transforming
easy
Isogram
Determine if a word or phrase is an isogram.
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
text formatting
easy
Perfect Numbers
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
control flow conditionals
integers
math
easy
Prime Factors
Compute the prime factors of a given natural number.
integers
math
easy
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
filtering
math
easy
Largest Series Product
Given a string of digits, calculate the largest product for a contiguous substring of digits of length n.
integers
strings
transforming
math
easy
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
algorithms
strings
transforming
easy
Secret Handshake
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
bitwise operations
control flow conditionals
easy
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
control flow conditionals
math
medium
Tournament
Tally the results of a small football competition.
parsing
text formatting
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
lists
transforming
easy
Pangram
Determine if a sentence is a pangram.
regular expressions
strings
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
classes
easy
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
control flow conditionals
recursion
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.
control flow conditionals
filtering
lists
medium
Crypto Square
Implement the classic method for composing secret messages called a square code.
regular expressions
strings
text formatting
transforming
easy
Diamond
Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.
control flow loops
text formatting
easy
Acronym
Convert a long phrase to its acronym
strings
filtering