Cs1 coding challenges

Practise cs1 with 90 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 · 52 Medium · 36 Hard · 2

Skills you'll practise: Nested loopsSymmetryDigit extractionDigit sumEdge casesLookup tablesPaddingRecurrencesSieve of EratosthenesSquare root bound2D arraysBit shifts
  • 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.

90 challenges
Easy

Disarium Number

Check whether a number equals the sum of its digits raised to their positions.

You'll learn Digit positionsInteger powers
BeginnerCS1High schoolLoopsNumbersmath
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
Easy

Contains the Character

Keep only the words that contain a given letter, ignoring case.

You'll learn Case-insensitive comparisonFiltering a list
BeginnerCS1HomeworkIntro programmingStudent-beginner
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
Easy

Spy Number

Check whether the sum of a number's digits equals the product of its digits.

You'll learn Digit sumDigit product
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Harshad Number

Check whether a number is divisible by the sum of its digits (a Harshad or Niven number).

You'll learn Digit sumDivisibility
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
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

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

Neon Number

Check whether the digit sum of a number's square equals the number.

You'll learn Digit sumSquaring
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Coin Toss Streaks

Find the longest streak of heads, the longest streak of tails and the number of streaks in a coin toss record.

You'll learn Run detectionCounting
BeginnerCS1DiceHomeworkIntro programmingProbabilityStudent-beginner
No solutions yet
Easy

Sum of Proper Divisors

Add up every divisor of n that is smaller than n.

You'll learn Divisor pairsSquare root bound
BeginnerCS1High schoolLoopsNumber-theoryNumbersPrimesmath
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
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
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
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
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

Hollow Right Triangle

Print only the outline of a right triangle of stars.

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

Payroll With Overtime

Compute each employee's weekly pay in cents with time and a half after 40 hours and double time after 50.

You'll learn Piecewise rulesInteger rounding
BeginnerCS1ConditionsFinanceFunctionsHomeworkIntro programmingStudent-beginner
No solutions yet