Java coding challenges

340 challenges you can solve in Java, from first loops to graphs, dynamic programming and machine learning. Write your code in the browser, run the tests instantly and get an AI review.

Easy · 193 Medium · 118 Hard · 29

Skills you'll practise: Nested loopsDigit extractionCountingLoopsString splittingConditionsSieve of Eratosthenes2D listsArithmeticBig number arithmeticCycle detectionDivisibility
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
341
Challenges
245
Solutions shared
9
Languages

All challenges

Search by name or topic, or filter by difficulty.

340 challenges
Medium

Pentagonal Pair

Count pairs of pentagonal numbers whose sum is pentagonal too.

You'll learn Integer square rootsPair enumeration
Competitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Easy

Mad Lib Builder

Fill the bracketed blanks of a story template with words, in order.

You'll learn String scanningCounters
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Hard

Ranked Pairs Winner

Find the ranked pairs winner of an election by locking head-to-head victories that do not make a cycle.

You'll learn Graph cycle detectionCustom sorting
AdvancedCS1CS50 styleHomeworkIntro programmingSortingStudent-beginnerVoting
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

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
Easy

Season From Month and Day

Given a month name and a day, return the season of the year in the Northern Hemisphere.

You'll learn Chained conditionsInput validation
BeginnerCS1ConditionsDates and timesFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Medium

Number Letter Counts

Count the letters needed to write every number from 1 to n in English words.

You'll learn String buildingBreaking numbers into parts
Competitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Easy

Interstate Highway Numbers

Classify an interstate highway number as a primary or auxiliary route and give its direction.

You'll learn Remainder arithmeticBranching
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Hollow Right Triangle

Print only the outline of a right triangle of stars.

You'll learn Nested loopsConditions
BeginnerCS1High schoolLoopsNested-loopsPatterns
No solutions yet
Hard

Non-Abundant Sums

Add up the numbers up to a limit that cannot be written as the sum of two abundant numbers.

You'll learn Divisor sievePair enumeration
AdvancedCompetitive-programmingNumber-theoryPrimesProject Euler stylemath
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
Easy

Hollow Pyramid

Print the outline of a centered pyramid: its two slanted sides and a solid base.

You'll learn Nested loopsConditions
BeginnerCS1High schoolLoopsNested-loopsPatterns
No solutions yet
Easy

Countdown Until Matching Digits

Count down from a two-digit number until both digits are the same.

You'll learn While loopsDigit extraction
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Medium

Sum of Big Numbers

Add up a list of numbers too long for any built-in integer type.

You'll learn Big number arithmeticString processing
Big integersCompetitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Easy

Password Modifier

Strengthen a password by swapping some letters for symbols and adding its length at the end.

You'll learn Character replacementString building
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
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

Highly Divisible Triangular Number

Find the first triangular number that has at least d divisors.

You'll learn Prime factorizationDivisor counting
Competitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Easy

Simple Statistics

Return the minimum, maximum and average of a list of whole numbers.

You'll learn AccumulatorsRunning minimum and maximum
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet