Math coding challenges

Practise math with 21 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Easy · 13 Medium · 8

Skills you'll practise: Floating pointFormulasPolymorphismAdapter patternAmortised costArithmeticArithmetic seriesAttack patternsCase analysisClosed formulasCoin changeCoordinates
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
226
Challenges
2
Solutions shared
3
Languages

All challenges

Search by topic, language, or difficulty.

21 challenges
Easy

Distance Between Points

Compute the straight-line distance between two points.

You'll learn Pythagorean theoremSquare roots
BeginnerFunctionsLearning-pathmath
No solutions yet
Easy

Cash: Fewest Coins

Give change with as few U.S. coins as possible.

You'll learn Greedy algorithmsCoin change
BeginnerGreedyStudent-beginnermath
No solutions yet
Medium

Raise a Fraction to a Real Power

Raise a positive fraction to a real-valued exponent.

You'll learn Real exponentsFloating point
Fractionsmath
No solutions yet
Medium

Raise a Number to a Fractional Power

Raise a positive real number to a rational exponent.

You'll learn Roots and powersFloating point
Fractionsmath
No solutions yet
Medium

Readability Grade

Estimate the school grade needed to read a text.

You'll learn Text analysisFormulas
BeginnerStringsStudent-beginnermath
No solutions yet
Medium

Empty Two Coin Piles

Decide whether paired removals can empty two piles.

You'll learn Math reasoningInvariants
Greedymath
No solutions yet
Medium

Exact Fraction Arithmetic

Perform fraction operations and return a reduced fraction.

You'll learn GCD reductionSign normalization
Fractionsmath
No solutions yet
Easy

Missing Number

Find the one number missing from 0..n.

You'll learn Arithmetic seriesSum difference trick
ArraysBeginnerStudent-beginnermath
No solutions yet
Medium

Two Nonattacking Knights

Count safe placements of two knights for each square board size.

You'll learn Counting placementsAttack patterns
Combinatoricsmath
No solutions yet
Easy

Count Handshakes

Count handshakes when every pair of people shakes hands once.

You'll learn Counting pairsClosed formulas
Combinatoricsmath
No solutions yet
Medium

Number Spiral Lookup

Find a value by row and column in an expanding number spiral.

You'll learn Math patternsCase analysis
Patternsmath
No solutions yet
Easy

Median of a List

Find the middle value of a list after sorting.

You'll learn SortingStatistics
Arraysmath
No solutions yet
Easy

Difference of Squares

Subtract the sum of squares from the square of the sum.

You'll learn FormulasArithmetic
Beginnermath
No solutions yet
Easy

Chess Square Color

Determine the color of a square on an 8 by 8 board.

You'll learn CoordinatesParity
Beginnermath
No solutions yet
Easy

Markov Chain State Distribution

Propagate a probability distribution through a Markov chain's transition matrix for a number of steps.

You'll learn Markov chainsProbability
Simulationaimath
No solutions yet
Easy

Hours, Minutes, and Seconds

Convert a duration in seconds to a compact readable string.

You'll learn Time unitsString formatting
Beginnermath
No solutions yet
Easy

Shape Factory

Create shapes from text descriptions with a factory and return the area of each one.

You'll learn Factory methodPolymorphism
Design patternsParsingmath
No solutions yet
Easy

Temperature Sensor Adapter

Adapt readings from Fahrenheit, Kelvin and Celsius sensors to one Celsius interface.

You'll learn Adapter patternUnit conversion
Design patternsParsingmath
No solutions yet