Sign up
Log in
Home
Language tracks
Kotlin track
Exercises
Exercises on the Kotlin track
Join the Kotlin Track
68 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
Two Fer
Create a sentence of the form "One for X, one for me."
conditionals
strings
easy
Leap
Given a year, report if it is a leap year.
control flow if else statements
integers
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
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
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
easy
Raindrops
Convert a number to a string, the contents of which depend 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
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
Sieve
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
algorithms
integers
lists
loops
math
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
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
Bracket Push
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
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
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
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
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.
enumeration
generics
lists
loops
searching
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
hard
List Ops
Implement basic list operations
filtering
functional programming
generics
lists
loops
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
Forth
Implement an evaluator for a very simple subset of Forth
exception handling
lists
logic
parsing
stacks
strings
hard
React
Implement a basic reactive system.
generics
higher order functions
nested classes
reactive programming