Intermediate coding challenges

Practise intermediate with 51 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.

Medium · 51

Skills you'll practise: Nested loopsPrimality testingSymmetryModular arithmeticBit shiftsCombinatoricsDynamic programmingLookup tablesPrime factorizationRecurrencesSimulationString building
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
341
Challenges
241
Solutions shared
9
Languages

All challenges

Search by name or topic, or filter by difficulty.

51 challenges
Medium

Hourglass Pattern

Print an hourglass of stars: an inverted pyramid on top of an upright one, sharing the single-star waist.

You'll learn Nested loopsSymmetry
CS1High schoolIntermediateLoopsNested-loopsPatterns
No solutions yet
Medium

Pandigital Products

Add up the products whose equation a × b = c uses the digits 1 to n exactly once.

You'll learn PermutationsSplitting strings
Competitive-programmingDynamic-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Medium

Counting Sundays

Count the months in a range of years that begin on a Sunday.

You'll learn Date arithmeticModular arithmetic
Competitive-programmingDates and timesIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Medium

Integer to Roman

Write a whole number from 1 to 3999 as a Roman numeral.

You'll learn Greedy algorithmsLookup tables
CS1High schoolIntermediateLoopsNumbersmath
No solutions yet
Medium

Kaprekar Number

Check whether the square of a d-digit number splits into a left part and a d-digit right part that add up to the number.

You'll learn Splitting numbersPowers of ten
CS1High schoolIntermediateLoopsNumbersmath
No solutions yet
Medium

Number to Words

Spell a whole number in English words, such as "one hundred twenty-three".

You'll learn Lookup tablesDecomposing numbers
CS1High schoolIntermediateLoopsNumbersmath
No solutions yet
Medium

Double Staircase

Print two staircases of # blocks that face each other across a two-space gap.

You'll learn Nested loopsPadding
CS1CS50 styleHigh schoolIntermediateLoopsNested-loopsPatterns
No solutions yet
Medium

Longest Run of Rolls

Find where the longest run of equal consecutive dice rolls starts and how long it is.

You'll learn Array scanningTracking the best result
AP Computer ScienceCS1ClassesDiceHomeworkIntermediateIntro programmingOOPProbabilityStudent-beginner
No solutions yet
Medium

Light Board

Simulate a board of lights where pressing one flips it and its neighbors, and answer count queries.

You'll learn 2D boolean gridsNeighbor offsets
AP Computer ScienceCS1ClassesGridsHomeworkIntermediateIntro programmingMatricesOOPStudent-beginner
No solutions yet
Medium

Modular Exponentiation

Compute base to the power exponent, modulo a number, with fast exponentiation.

You'll learn Exponentiation by squaringModular arithmetic
CS1High schoolIntermediateLoopsNumber-theoryNumbersPrimesmath
No solutions yet
Medium

Derangements

Count the arrangements of n items where nothing stays in its original place.

You'll learn RecurrencesCombinatorics
CS1Dynamic-programmingHigh schoolIntermediateLoopsNumbersmath
No solutions yet
Medium

Number Diamond

Print a diamond whose rows count up from 1 to a peak and back down.

You'll learn Nested loopsSymmetry
CS1High schoolIntermediateLoopsNested-loopsPatterns
No solutions yet
Medium

Truncatable Primes

List the primes up to a limit that stay prime as digits are removed from either end.

You'll learn Primality testingNumber truncation
Competitive-programmingIntermediateNumber-theoryPrimesProject Euler stylemath
No solutions yet
Medium

Euler's Totient

Count the integers from 1 to n that share no common factor with n.

You'll learn Prime factorizationProduct formula
CS1High schoolIntermediateLoopsNumber-theoryNumbersPrimesmath
No solutions yet
Medium

Circular Primes

Count the primes up to a limit whose every digit rotation is also prime.

You'll learn Primality testingDigit rotation
Competitive-programmingIntermediateNumber-theoryPrimesProject Euler stylemath
No solutions yet