teams edition
Sign up
Log in
Home
Language tracks
Prolog track
Exercises
Exercises on the Prolog track
Join the Prolog Track
19 exercises to help you master Prolog
easy
Hello World
The classical introductory exercise. Just say "Hello, World!"
misc
easy
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.
misc
easy
Triangle
Determine if a triangle is equilateral, isosceles, or scalene.
misc
easy
Isogram
Determine if a word or phrase is an isogram.
misc
easy
Binary
Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles
math
easy
RNA Transcription
Given a DNA strand, return its RNA Complement Transcription.
misc
easy
Anagram
Given a word and a list of possible anagrams, select the correct sublist.
misc
easy
Pascal's Triangle
Compute Pascal's triangle up to a given number of rows.
math
easy
Dominoes
Make a chain of dominoes.
misc
easy
Satellite
Rebuild binary trees from pre-order and in-order traversals.
binary trees
recursion
tree traversals
easy
Spiral Matrix
Given the size, return a square matrix of numbers in spiral order.
misc
easy
Nucleotide Count
Given a DNA string, compute how many times each nucleotide occurs in the string.
misc
easy
Hamming
Calculate the Hamming difference between two DNA strands.
misc
easy
Complex Numbers
Implement complex numbers.
math
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
Leap
Given a year, report if it is a leap year.
misc
easy
Space Age
Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
misc
easy
Grains
Calculate the number of grains of wheat on a chessboard given that the number on each square doubles.
misc
easy
Wordy
Parse and evaluate simple math word problems returning the answer as an integer.
parsing