Sign up
Log in
Home
Language tracks
Kotlin track
Exercises
Exercises on the Kotlin track
Join the Kotlin Track
82 exercises to help you master Kotlin
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
strings
easy
Reverse String
Reverse a string
strings
easy
D&D Character
Randomly generate Dungeons & Dragons characters
integers
randomness
easy
Two Fer
Create a sentence of the form "One for X, one for me."
conditionals
strings
easy
Resistor Color
Convert a resistor band's color to its numeric representation
lists
easy
Resistor Color Duo
Convert color codes, as used on resistors, to a numeric value.
lists
easy
Resistor Color Trio
Convert color codes, as used on resistors, to a human-readable label.
math
type conversion
lists
easy
Leap
Given a year, report if it is a leap year.
integers
conditionals
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
loops
maps
strings
easy
Darts
Write a function that returns the earned points in a single toss of a Darts game
pattern matching
conditionals
math
easy
Pangram
Determine if a sentence is a pangram.
pattern matching
regular expressions
strings
easy
Hamming
Calculate the Hamming difference between two DNA strands.
integers
loops
strings
easy
Gigasecond
Given a moment, determine the moment that would be after a gigasecond has passed.
dates
integers
time
easy
Custom Set
Create a custom set type.
object oriented programming
sets
varargs
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
easy
Scrabble Score
Given a word, compute the Scrabble score for that word.
games
loops
pattern matching
strings
transforming
medium
Matrix
Given a string representing a matrix of numbers, return the rows and columns of that matrix.
loops
strings
pattern matching
type conversion
transforming
easy
Wordy
Parse and evaluate simple math word problems returning the answer as an integer.
loops
pattern matching
strings
recursion
easy
Crypto Square
Implement the classic method for composing secret messages called a square code.
strings
text formatting
transforming
easy
Raindrops
Convert a number to a string, the content of which depends on the number's factors.
conditionals
integers
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.
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
easy
Yacht
Score a single throw of dice in the game Yacht
enums
functional programming
lists
pattern matching
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
medium
Luhn
Given a number determine whether or not it is valid per the Luhn formula.
algorithms
booleans
loops
strings
type conversion
medium
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
conditionals
exception handling
integers
recursion
medium
Largest Series Product
Given a string of digits, calculate the largest product for a contiguous substring of digits of length n.
integers
loops
strings
type conversion
math
medium
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
integers
medium
Forth
Implement an evaluator for a very simple subset of Forth
pattern matching
integers
medium
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
algorithms
integers
lists
loops
math
medium
Kindergarten Garden
Given a diagram, determine which plants each child in the kindergarten class is responsible for.
arrays
enumerations
lists
logic
loops
pattern recognition
strings
medium
Collatz Conjecture
Calculate the number of steps to reach 1 using the Collatz conjecture
conditionals
exception handling
integers
recursion
math
medium
Atbash Cipher
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
cryptography
security
strings
medium
Affine Cipher
Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.
cryptography
security
strings
medium
Nth Prime
Given a number n, determine what the nth prime is.
arrays
exception handling
integers
lists
loops
math
medium
Saddle Points
Detect saddle points in a matrix.
arrays
conditionals
exception handling
integers
loops
medium
Diamond
Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.
arrays
lists
loops
strings
text formatting
medium
Isogram
Determine if a word or phrase is an isogram.
conditionals
loops
parsing
strings
medium
Flatten Array
Take a nested list and return a single list with all values except nil/null
stacks
strings
medium
Pig Latin
Implement a program that translates from English to Pig Latin
arrays
lists
strings
transforming
medium
Rail Fence Cipher
Implement encoding and decoding for the rail fence cipher.
cryptography
algorithms
strings
transforming
medium
Phone Number
Clean up user-entered phone numbers so that they can be sent SMS messages.
conditionals
pattern matching
regular expressions
strings
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
Word Count
Given a phrase, count the occurrences of each word in that phrase.
conditionals
integers
loops
maps
strings
medium
Spiral Matrix
Given the size, return a square matrix of numbers in spiral order.
arrays
integers
loops
matrices
medium
Robot Name
Manage robot factory settings.
pattern matching
randomness
regular expressions
strings
text formatting
medium
Prime Factors
Compute the prime factors of a given natural number.
arrays
conditionals
integers
lists
loops
math
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
medium
Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
booleans
conditionals
strings
medium
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
algorithms
arrays
exception handling
integers
matrices
math
medium
Matching Brackets
Make sure the brackets and braces all match.
stacks
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
easy
Armstrong Numbers
Determine if a number is an Armstrong number
algorithms
loops
math
medium
Rotational Cipher
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
cryptography
integers
strings
medium
ISBN Verifier
Check if a given string is a valid ISBN-10 number.
integers
loops
strings
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
Roman Numerals
Write a function to convert from normal numbers to Roman Numerals.
integers
logic
loops
maps
strings
medium
Beer Song
Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
conditionals
loops
strings
text formatting
variables
medium
ETL
We are going to do the `Transform` step of an Extract-Transform-Load.
lists
maps
transforming
hard
Forth
Implement an evaluator for a very simple subset of Forth
exception handling
lists
logic
parsing
stacks
strings
medium
Linked List
Implement a doubly linked list
algorithms
generics
lists
medium
Grade School
Given students' names along with the grade that they are in, create a roster for the school
conditionals
lists
maps
sorting
strings
medium
Robot Simulator
Write a robot simulator.
classes
enumerations
logic
loops
medium
Binary Search
Implement a binary search algorithm.
arrays
generics
recursion
searching
medium
Binary Search Tree
Insert and search for numbers in a binary tree.
arrays
generics
recursion
searching
medium
Minesweeper
Add the numbers to a minesweeper board
conditionals
games
integers
lists
matrices
strings
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
Say
Given a number from 0 to 999,999,999,999, spell out that number in English.
strings
transforming
hard
Zebra Puzzle
Solve the zebra puzzle.
algorithms
arrays
conditionals
games
medium
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
arrays
conditionals
equality
lists
loops
strings
medium
Sublist
Write a function to determine if a list is a sublist of another list.
generics
lists
loops
searching
enumerations
medium
Meetup
Calculate the date of meetups.
conditionals
dates
enumerations
loops
medium
Clock
Implement a clock that handles times without dates.
equality
integers
logic
object oriented programming
strings
time
medium
Dominoes
Make a chain of dominoes.
algorithms
exception handling
games
lists
hard
List Ops
Implement basic list operations
filtering
functional programming
generics
lists
loops
hard
Diffie Hellman
Diffie-Hellman key exchange.
cryptography
randomness
algorithms
integers
hard
Simple Cipher
Implement a simple shift cipher like Caesar and a more secure substitution cipher
cryptography
exception handling
randomness
security
strings
hard
Complex Numbers
Implement complex numbers.
floating point numbers
math
hard
Change
Correctly determine change to be given using the least number of coins
algorithms
exception handling
integers
lists
hard
React
Implement a basic reactive system.
generics
reactive programming
functional programming
classes