Rust coding challenges

340 challenges you can solve in Rust, 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
Easy

Tribonacci

Return the nth tribonacci number, where each term is the sum of the three before it.

You'll learn LoopsRolling variables
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Inverted Right Triangle

Print a right triangle upside down: n stars on the first row, one on the last.

You'll learn Nested loopsCounting down
BeginnerCS1High schoolLoopsNested-loopsPatterns
No solutions yet
Medium

Spell Checker

List the words in a text that are missing from a dictionary, ignoring case and punctuation.

You'll learn Hash setsTokenizing text
CS1CS50 styleDictionariesHash tablesHomeworkIntermediateIntro programmingStudent-beginner
No solutions yet
Medium

Lexicographic Permutation

Find the k-th arrangement of some distinct characters in dictionary order.

You'll learn Factorial number systemCombinatorics
Competitive-programmingIntermediateNumber-theoryProject Euler styleRecursionmath
No solutions yet
Easy

Grocery List Totals

Add up a grocery receipt in cents, charging sales tax only on taxable items.

You'll learn Parsing recordsInteger money math
BeginnerCS1FinanceHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Output Range With Increment

List the numbers from a start value toward an end value, moving by a fixed step.

You'll learn Loop conditionsEdge cases
BeginnerCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet
Easy

Remove Gray From RGB

Remove the gray part of an RGB color by subtracting the smallest channel from all three.

You'll learn Minimum of valuesInput validation
BeginnerBit manipulationCS1ConditionsFunctionsHomeworkIntro programmingStudent-beginner
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
Easy

Lucas Numbers

Return the nth Lucas number, the Fibonacci-like sequence that starts 2, 1.

You'll learn LoopsRecurrences
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Abundant, Perfect or Deficient

Classify a number as abundant, perfect or deficient by the sum of its proper divisors.

You'll learn Divisor pairsSquare root bound
BeginnerCS1High schoolLoopsNumber-theoryNumbersPrimesmath
No solutions yet
Easy

X Pattern

Draw both diagonals of an n by n square with stars to form an X.

You'll learn Nested loopsGrid coordinates
BeginnerCS1High schoolLoopsNested-loopsPatterns
No solutions yet
Medium

Quadratic Primes

Find the quadratic n² + an + b that gives the longest run of primes from n = 0.

You'll learn Primality testingBrute-force search
Competitive-programmingIntermediateNumber-theoryPrimesProject Euler stylemath
No solutions yet
Easy

Digit Sum of a Power of Two

Add up the decimal digits of 2 raised to the power n.

You'll learn Big number arithmeticDigit manipulation
BeginnerBig integersCompetitive-programmingNumber-theoryProject Euler stylemath
No solutions yet
Medium

Champernowne Digits

Find digits at given positions of the string 123456789101112... made by writing out the counting numbers.

You'll learn Digit countingBlock skipping
Competitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Medium

Catalan Numbers

List the Catalan numbers C(0) to C(n).

You'll learn Dynamic programmingRecurrences
CS1Dynamic-programmingHigh schoolIntermediateLoopsNumbersmath
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

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

Ticket Lottery Winners

Count how many lottery tickets matched 0, 1, 2, ... of the winning numbers.

You'll learn Set membershipFrequency counts
CS1GamesHomeworkIntermediateIntro programmingStudent-beginner
No solutions yet