Sign up
Log in
Home
Language tracks
Groovy track
Exercises
Exercises on the Groovy track
Join the Groovy Track
52 exercises to help you master Groovy
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
strings
easy
Raindrops
Convert a number to a string, the contents of which depend on the number's factors.
strings
medium
Isogram
Determine if a word or phrase is an isogram.
conditionals
loops
parsing
strings
medium
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
arrays
conditionals
equality
lists
loops
strings
easy
Two Fer
Create a sentence of the form "One for X, one for me."
control flow if else statements
strings
conditionals
easy
Reverse String
Reverse a string
strings
easy
Resistor Color
Convert a resistor band's color to its numeric representation
arrays
strings
easy
Darts
Write a function that returns the earned points in a single toss of a Darts game
games
easy
Protein Translation
Translate RNA sequences into proteins.
arrays
conditionals
loops
strings
medium
Proverb
For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Output the full text of this proverbial rhyme.
arrays
loops
strings
medium
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
booleans
conditionals
strings
easy
Hamming
Calculate the Hamming difference between two DNA strands.
strings
integers
loops
easy
Resistor Color Duo
Convert color codes, as used on resistors, to a numeric value.
arrays
strings
medium
ISBN Verifier
Check if a given string is a valid ISBN-10 number.
integers
loops
strings
medium
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
algorithms
booleans
loops
strings
type conversion
medium
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
regular expressions
strings
conditionals
pattern matching
medium
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
conditionals
exception handling
integers
maps
parsing
searching
strings
medium
Series
Given a string of digits, output all the contiguous substrings of length `n` in that string.
conditionals
lists
loops
strings
type conversion
medium
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
integers
logic
loops
maps
strings
medium
Gigasecond
Given a moment, determine the moment that would be after a gigasecond has passed.
dates
integers
time
easy
Leap
Given a year, report if it is a leap year.
logical operators
control flow if else statements
integers
medium
Allergies
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
booleans
conditionals
enumerations
integers
lists
loops
easy
Scrabble Score
Given a word, compute the scrabble score for that word.
strings
games
loops
pattern matching
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.
math
integers
loops
easy
Perfect Numbers
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
enumerations
exception handling
filtering
integers
math
medium
Sum Of Multiples
Given a number, find the sum of all the multiples of particular numbers up to but not including that number.
arrays
conditionals
integers
loops
math
easy
Secret Handshake
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
bitwise operations
conditionals
cryptography
enumerations
integers
loops
transforming
medium
Matrix
Given a string representing a matrix of numbers, return the rows and columns of that matrix.
arrays
integers
loops
lists
pattern matching
type conversion
medium
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
booleans
classes
exception handling
medium
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
conditionals
exception handling
integers
math
recursion
medium
Nth Prime
Given a number n, determine what the nth prime is.
math
arrays
exception handling
integers
lists
loops
medium
Prime Factors
Compute the prime factors of a given natural number.
arrays
conditionals
integers
lists
loops
math
medium
Rotational Cipher
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
cryptography
integers
strings
medium
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
cryptography
security
strings
medium
Run Length Encoding
Implement run-length encoding and decoding.
integers
pattern matching
strings
transforming
medium
Saddle Points
Detect saddle points in a matrix.
arrays
conditionals
integers
lists
loops
matrices
sets
medium
All Your Base
Convert a number, represented as a sequence of digits in one base, to any other base.
arrays
conditionals
exception handling
integers
loops
math
medium
Flatten Array
Take a nested list and return a single list with all values except nil/null
arrays
lists
loops
recursion
medium
Matching Brackets
Make sure the brackets and braces all match.
stacks
strings
easy
Word Count
Given a phrase, count the occurrences of each word in that phrase.
strings
conditionals
integers
loops
maps
medium
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
lists
maps
transforming
easy
Robot Name
Manage robot factory settings.
randomness
pattern matching
regular expressions
strings
text formatting
medium
Binary Search
Implement a binary search algorithm.
algorithms
collections
lists
searching
recursion
medium
Bank Account
Simulate a bank account supporting opening/closing, withdraws, and deposits of money. Watch out for concurrent transactions!
concurrency
exception handling
integers
medium
Linked List
Implement a doubly linked list
algorithms
generics
lists
easy
Armstrong Numbers
Determine if a number is an Armstrong number
integers
math
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
loops
maps
strings
easy
Pangram
Determine if a sentence is a pangram.
pattern matching
regular expressions
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
easy
Acronym
Convert a long phrase to its acronym
loops
parsing
searching
strings
medium
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
integers
easy
High Scores
Manage a player's High Score list
lists