Free coding practice
154 coding exercises and practice problems
Choose a language, topic and difficulty, then write and run real code in your browser. Start with a guided exercise that teaches one idea, or move to a graded problem with examples, additional checks and a complexity target.
57 introductory49 easy29 medium19 hard8 debugging labs13 languages · runs and checks in your browser
From your first line to interview-style problem solving
The 130 guided exercises are grouped into real language paths. Each opens with starter code, runs beside the explanation, checks the result and links to the next exercise, so you always know what to do after a successful run.
The 24 graded problems cover shapes that come up in technical interviews and, more usefully, the ones that teach you to reason about what your code costs. Each states its constraints and a complexity target up front, so you know what you are aiming for rather than guessing whether a working answer is a good one.
The debugging labs work the other way round: you are handed a program that runs but produces the wrong answer, plus the bug report. Most of a working developer's day looks more like that than like writing from a blank editor, and the same additional checks decide when you have actually fixed it.
They are a big step up from the beginner exercises. If a problem statement reads as a wall of words, that is a sign to do the exercises and the lessons first, then come back.
Find your next coding exercise
All 154 activities below are real, runnable pages. Filter the complete catalogue or let SkillAIVibe pick one from the current results.
154 activities
Guided exercises
130 shownShort, ordered tasks that teach one idea at a time and check your output as you run.
- Trail SignpostIntroA neatly aligned trailhead signpost: a header, three destinations with their distances in a straight column, and a footer, printed by five echo commands.Bash & the Shell · Output and quotingNew idea: echo prints one line, and double quotes keep spacing exactly as typedOpen exercise →
- Lost and FoundIntroA four-line notice for a station lost-and-found desk, with the item, the place it was found and the collection desk each filled in from a variable.Bash & the Shell · VariablesNew idea: Variables: name=value with no spaces, $name to use it, and single quotes stop expansionOpen exercise →
- Moving-Day BoxesEasyA three-line moving-day estimate: rooms, total boxes, and rolls of tape at ten boxes per roll, rounded up, with the numbers lined up in a column.Bash & the Shell · Arithmetic and printfNew idea: $((...)) does whole-number arithmetic, and printf formats columns but never adds a newlineOpen exercise →
- Rainwater Tank GaugeEasyA two-line gauge readout for a rainwater tank: one line chosen by an if/elif/else on the level, and one line showing the exit status of a comparison run on its own.Bash & the Shell · Conditions and exit statusNew idea: if runs a command and checks its exit status; [ ] compares numbers with -lt/-gt and needs spaces around its bracketsOpen exercise →
- Photo Rename PlanEasyThree lines showing how each photo would be renamed to its _small version, followed by three numbered contact-sheet page lines produced with seq.Bash & the Shell · LoopsNew idea: for loops over a word list, and ${name} braces mark where a variable name endsOpen exercise →
- Downloads Tidy-UpEasyA six-line plan for tidying a downloads folder, one line per file, saying which folder each file should be moved to based on its extension.Bash & the Shell · Pattern matching with caseNew idea: case matches one value against glob patterns, each branch ending in ;;Open exercise →
- Bakery Oven TimesMediumA three-line bakery timetable saying when the sourdough, baguettes and croissants come out of the oven, each time computed by one small function and printed as HH:MM.Bash & the Shell · FunctionsNew idea: Functions take $1 $2 arguments, print their result, and are captured with $(...)Open exercise →
- Cabin Guest BookMediumA guest book built up in guests.txt, then printed back with cat, counted with wc -l, and turned into three personalised welcome lines by a while read loop.Bash & the Shell · Files and redirectionNew idea: > creates a file, >> appends to it, and while read ... done < file reads it line by lineOpen exercise →
- Birdwatching TallyMediumA summary of a birdwatching log: total sightings, number of species, number of robins, and a tally of every bird from most to least seen, each answered by a short pipeline.Bash & the Shell · Pipes and filtersNew idea: Pipes chain sort, uniq -c, grep -c and wc -l into a tallyOpen exercise →
- Library Overdue ReportHardA seven-line report: one aligned row per book with title, days overdue, fine at 25p a day and the action to take, followed by the total owed, how many books were on time, and the most overdue title found with a sort pipeline.Bash & the Shell · Putting it togetherNew idea: IFS=, read splits a comma-separated line into fields for that one readOpen exercise →
- Hello, Out LoudIntroA banner with your own name inside it, printed by a C program that you compiled and ran yourself.C · OutputNew idea: printf() puts text on the screenOpen exercise →
- Name TagIntroA bordered name-tag card with your own name across three of its lines, every one of them fed by a single line of code.C · VariablesNew idea: A variable is declared with a type, and holds one value under a nameOpen exercise →
- Party PlannerIntroA pizza order summary that works itself out from the guest list — slices needed, whole pizzas, and the slices that spill past them.C · ArithmeticNew idea: C does arithmetic with + - * / and %, and / between two ints throws away the remainderOpen exercise →
- Umbrella or NotIntroA rain report card that reads the forecast for you and signs off with a straight answer — take the umbrella, or leave it at home.C · ConditionsNew idea: if/else chooses between two different blocks of codeOpen exercise →
- CountdownIntroA launch sequence that counts itself down from five to one, announces liftoff and draws a small rocket, with the whole countdown written as one line that runs five times.C · LoopsNew idea: a for loop repeats a block a fixed number of timesOpen exercise →
- The Clapping GameIntroA count from one to twenty where every third number is replaced by a clap, so the beat is visible straight down the screen.C · Loops and conditionsNew idea: An if inside a for loop is decided again on every passOpen exercise →
- The ScoreboardEasyA game scoreboard where every name, score and bar of # characters lands in the same column, built entirely from printf's own field-width numbers rather than spaces typed by hand.C · Strings and formattingNew idea: a number between % and the conversion letter gives printf a fixed field widthOpen exercise →
- Packing ListEasyA travel packing checklist with a banner, one tick-box line for every item on the list, and a footer that counts them for you.C · ArraysNew idea: An array holds several values of one type in order, indexed from zero with []Open exercise →
- Rainfall WeekMediumA seven-day rainfall chart with a row for every day, the week added up underneath it, and the wettest of the seven days picked out.C · Putting it togetherNew idea: A variable declared before a loop carries its value from one pass to the nextOpen exercise →
- The Cafe TicketHardA printed cafe receipt with the shop name at the top, three item rows in straight columns, a subtotal, a service charge the program works out itself, a total, and a thank-you line at the bottom.C · A complete programNew idea: Assembling a complete program from parts you already knowOpen exercise →
- Hello, Out LoudIntroA banner with your own name inside it, printed by a C++ program you compiled and ran yourself.C++ · OutputNew idea: std::cout sends text to the screenOpen exercise →
- Name TagIntroA bordered name-tag card with your own name across three of its lines, every one of them fed by a single line of code.C++ · VariablesNew idea: A variable is a named, typed place to keep a valueOpen exercise →
- Party PlannerIntroA pizza order summary that works itself out from the guest list — slices needed, whole pizzas, and the slices that spill past them.C++ · ArithmeticNew idea: C++ does arithmetic with + - * / and %Open exercise →
- Umbrella or NotIntroA rain report card that reads the forecast for you and signs off with a straight answer — take the umbrella, or leave it at home.C++ · ConditionsNew idea: if/else chooses between two different outcomesOpen exercise →
- CountdownIntroA launch sequence that counts itself down from five to one, announces liftoff and draws a small rocket, with the whole countdown written as one line that runs five times.C++ · LoopsNew idea: a for loop repeats an actionOpen exercise →
- The Clapping GameIntroA count from one to twenty where every third number is replaced by a clap, so the beat is visible straight down the screen.C++ · Loops and conditionsNew idea: An if inside a for loop, decided again on every passOpen exercise →
- The ScoreboardEasyA game scoreboard where every name, score and bar lands in the same column, built by giving each value a fixed width before it prints.C++ · Strings and formattingNew idea: std::setw and std::left/std::right line values up in columnsOpen exercise →
- Packing ListEasyA travel packing checklist with a banner, one tick-box line for every item on the list, and a footer that counts them for you.C++ · VectorsNew idea: std::vector holds many values in order, and a range-based for loop walks through themOpen exercise →
- Rainfall WeekMediumA seven-day rainfall chart with a row for every day, the week added up underneath it, and the wettest of the seven days picked out.C++ · Putting it togetherNew idea: A variable made before a loop carries a running total from pass to passOpen exercise →
- The Cafe TicketHardA printed cafe receipt with the shop name at the top, three item rows in straight columns, a subtotal, a service charge the program works out itself, a total, and a thank-you line at the bottom.C++ · A complete programNew idea: Assembling a complete program from parts you already knowOpen exercise →
- Coat Check Claim TicketIntroA small console program that prints a coat-check claim ticket with a claim number, an item description, and a rack number.C# · Variables & OutputNew idea: Declaring typed variables and printing their values with string interpolationOpen exercise →
- Spelling Test Pass CheckerIntroA program that takes a student's spelling test score and prints whether they passed.C# · ConditionalsNew idea: Branching with if/else based on a comparisonOpen exercise →
- Ferris Wheel Car NumberingEasyA program that prints a numbered list of ferris wheel cars along with how many seats each one has.C# · LoopsNew idea: Repeating a block a fixed number of times with a for loopOpen exercise →
- Vending Machine RestockEasyA program that restocks a vending machine slot one item at a time until it reaches capacity.C# · LoopsNew idea: Repeating a block with a while loop until a condition becomes falseOpen exercise →
- Airport Security Line StatusEasyA program that reads how many minutes a traveler waited in a security line and prints a status label for it.C# · Reading InputNew idea: Reading a line from the console and parsing it into a numberOpen exercise →
- Chess Club Weekly AttendanceEasyA program that stores a week of chess club attendance counts in an array and prints each night's count plus the total.C# · ArraysNew idea: Storing multiple values in an array and looping over it safely by indexOpen exercise →
- Household Chore RotationMediumA program that builds a rotating list of household chores by adding names and prints whose turn is next.C# · ListsNew idea: Using a List<string> to add items dynamically and read its CountOpen exercise →
- Craft Fair Booth SalesMediumA program that filters a craft fair vendor's sales to the ones above a minimum amount and totals just those.C# · LINQNew idea: Using LINQ's Where and Sum to filter and total a listOpen exercise →
- Town Hall Attendance by DistrictHardA program that tracks how many residents from each district signed in to a town hall meeting and prints a per-district report.C# · DictionariesNew idea: Using a Dictionary<string,int> and ContainsKey to look up values safely by keyOpen exercise →
- Summer Camp Swim Test ResultsHardA program that goes through a list of campers' swim test lap counts, labels each as 'cleared' or 'not yet', and prints a summary report.C# · Putting It TogetherNew idea: Combining lists, loops, and conditionals while avoiding integer-division truncationOpen exercise →
- Library Due-Date ReminderIntroA two-line console message that reminds a borrower which book is due and how many days they have left.Go · Variables and printingNew idea: Declaring variables with := and printing them with fmt.Println and fmt.Printf, including a format string that must end with \nOpen exercise →
- Recipe ScalerEasyA program that takes a 4-serving recipe, works out the amount of flour and eggs per serving, and figures out what a doubled batch needs.Go · Arithmetic operatorsNew idea: Arithmetic on ints with +, -, *, and /, including that integer division truncates instead of rounding (7 / 2 is 3)Open exercise →
- Parking Meter StatusEasyA program that subtracts elapsed time from paid time and prints whether the meter is OK, almost expired, or expired.Go · Conditionals (if/else)New idea: Branching with if / else if / else and comparison operators (<=, etc.)Open exercise →
- Bus TimetableEasyA program that lists five upcoming bus departure times, spaced out by a fixed interval.Go · For loopsNew idea: Counting for loops (for i := 0; i < n; i++) that compute a new value on each passOpen exercise →
- Poem Word CounterEasyA program that reads one line of a poem from standard input (or falls back to a default line when there's no input) and reports how many words are in it.Go · Reading input and stringsNew idea: Reading a line with bufio, cleaning it with strings.TrimSpace, and splitting it into words with strings.FieldsOpen exercise →
- Tool Shed InventoryEasyA numbered inventory listing for a tool shed, built from a slice that starts with three tools and gains a fourth.Go · SlicesNew idea: Slices: literals, growing one with append (and keeping its result), indexing, and len() inside a loopOpen exercise →
- Currency ConverterMediumA program that converts a fixed USD amount into euros, pounds, and yen using a map of fixed exchange rates.Go · MapsNew idea: Maps: map[string]float64 literals, looking values up by key (including the zero-value gotcha for a missing key), and formatting floats with %.2fOpen exercise →
- Board Game LeaderboardHardA leaderboard for a board game night that finds the top score with a helper function and marks the winning player.Go · FunctionsNew idea: Writing and calling a function with a parameter and a return value: func highestScore(scores []int) intOpen exercise →
- Playlist RuntimeHardA playlist printout showing each song's length as minutes:seconds, plus the total runtime of the whole playlist.Go · Structs and methodsNew idea: Defining a struct with fields and a method on it (func (s Song) Format() string), used across a slice of structsOpen exercise →
- Tip Jar SplitHardA program that splits a night's tip jar among three cafe workers, proportional to the hours each one worked.Go · Combining conceptsNew idea: Combining a struct, a helper function, and a loop to compute a proportional split with float formatting (%.1f and %.2f)Open exercise →
- Hello, Out LoudIntroA banner with your own name inside it, printed by Java code that you compiled and ran yourself.Java · OutputNew idea: System.out.println prints a line, and a Java program always starts inside a main methodOpen exercise →
- Name TagIntroA bordered name-tag card with your own name across three of its lines, every one of them fed by a single line of code.Java · VariablesNew idea: A variable in Java has a fixed type, and String stores text under a reusable nameOpen exercise →
- Party PlannerIntroA pizza order summary that works itself out from the guest list — slices needed, whole pizzas, and the slices that spill past them.Java · ArithmeticNew idea: Java splits division into two operators: / for whole groups, % for what's left overOpen exercise →
- Umbrella or NotIntroA rain report card that reads the forecast for you and signs off with a straight answer — take the umbrella, or leave it at home.Java · ConditionsNew idea: if/else chooses between two outcomes, and the test inside it must itself be true or falseOpen exercise →
- CountdownIntroA launch sequence that counts itself down from five, then prints a liftoff banner and a small rocket.Java · LoopsNew idea: A for loop's own three parts, not a helper function, decide how it countsOpen exercise →
- The Clapping GameIntroA count from one to twenty where every third number comes out as a clap instead, so the beat runs in a straight line down the screen.Java · Loops and conditionsNew idea: An if nested inside a for loop is decided again on every pass through the loopOpen exercise →
- The ScoreboardEasyA game scoreboard where every name, score and bar lands in the same column, with each row built from one formatted piece of text rather than pasted-together pieces.Java · Strings and formattingNew idea: String.format drops values into fixed-width slots so columns line upOpen exercise →
- Packing ListEasyA travel packing checklist with a banner, one tick-box line for every item you add to the list, and a footer that counts them for you.Java · ListsNew idea: ArrayList holds a growable list of values, walked with a for-each loopOpen exercise →
- Rainfall WeekMediumA seven-day rainfall chart with a row for every day, the week added up underneath it, and the wettest of the seven days picked out.Java · Putting it togetherNew idea: A variable created above a loop carries a running value from one pass to the nextOpen exercise →
- The Cafe TicketHardA printed cafe receipt with the shop name at the top, three item rows in straight columns, a subtotal, a service charge the program works out itself, a total, and a thank-you line at the bottom.Java · A complete programNew idea: Assembling a complete program from parts you already knowOpen exercise →
- Hello, Out LoudIntroA four-line banner with your own name inside it, put on the screen by JavaScript you ran yourself.JavaScript · OutputNew idea: console.log() puts text on the screenOpen exercise →
- Name TagIntroA bordered name-tag card carrying your own name on three of its lines, all three fed by a single value you wrote once at the top.JavaScript · VariablesNew idea: const gives a value a name you can use againOpen exercise →
- Party PlannerIntroA pizza order that works itself out from the guest list: the slices wanted, the whole pizzas that covers, and the slices that spill past them.JavaScript · ArithmeticNew idea: JavaScript does arithmetic, and whole-number division needs Math.floor and %Open exercise →
- Umbrella or NotIntroA rain report card that holds today's forecast up against your own umbrella mark and signs off with one of two answers: take it, or leave it at home.JavaScript · ConditionsNew idea: if/else chooses between two outcomesOpen exercise →
- CountdownIntroA launch sequence that counts itself down from five to one, announces liftoff and draws a small rocket, with the whole countdown written as one line that runs five times.JavaScript · LoopsNew idea: a for loop repeats an actionOpen exercise →
- The Clapping GameIntroA count from one to twenty where every third number comes out as a clap instead, so the beat runs in a straight line down the screen.JavaScript · Loops and conditionsNew idea: an if inside a for, decided again on every passOpen exercise →
- The ScoreboardEasyA game scoreboard where every name, score and bar lands in the same column, with each row built as one piece of text that has the values sitting inside it.JavaScript · Strings and formattingNew idea: template literals build text with values inside itOpen exercise →
- Packing ListEasyA travel checklist with a banner, one tick-box line for every item sitting inside the square brackets, and a footer that counts the items without being told how many there are.JavaScript · ArraysNew idea: an array holds several values in order, and for...of walks through themOpen exercise →
- Rainfall WeekMediumA seven-day rainfall chart with a bar for every day, the week added up underneath it, and the wettest of the seven days picked out by its number.JavaScript · Putting it togetherNew idea: a value declared with let above a loop carries a running total from pass to passOpen exercise →
- The Cafe TicketHardA printed cafe receipt: the shop name across the top, three item rows whose quantity, unit price and amount all land in straight columns, a subtotal, a service charge the program works out itself, a total, and a thank-you line.JavaScript · A complete programNew idea: assembling a complete program out of parts you already knowOpen exercise →
- First Lines of PHPIntroTwo lines of welcome text printed to the screen, from code you repaired yourself.PHP · OutputNew idea: echo prints text, and every statement ends with a semicolonOpen exercise →
- Greet By NameIntroA personalized greeting built by combining text with a variable, instead of typing the name straight into the string.PHP · VariablesNew idea: a variable stores a value under a name starting with $Open exercise →
- Ticket TotalIntroA small receipt that multiplies a ticket price by a quantity and prints the total cost.PHP · ArithmeticNew idea: arithmetic operators (+ - * /) and joining text with .Open exercise →
- Open or ClosedIntroA message that changes depending on the hour stored in a variable — 'open' or 'closed' — decided by the program itself.PHP · ConditionsNew idea: if/else with && requiring every part of a condition to be trueOpen exercise →
- Launch CountdownIntroA countdown from 5 down to 1, printed one number per line, followed by a liftoff message.PHP · LoopsNew idea: a for loop repeats a block a set number of timesOpen exercise →
- Even Numbers OnlyIntroA program that walks through the numbers 1 to 10 and prints only the even ones, using % to test each number as the loop reaches it.PHP · Loops and conditionsNew idea: an if inside a for loop, decided again on every passOpen exercise →
- Score ReportEasyA neatly formatted line of text with a player's ID, name and score lined up using sprintf(), instead of stitched together with dots.PHP · Strings and formattingNew idea: sprintf() builds a formatted string from a templateOpen exercise →
- Packing ListEasyA packing list printed one item per line from an array, using foreach instead of a separate echo for every item.PHP · ArraysNew idea: an array holds several values, and foreach walks through themOpen exercise →
- Total WeightMediumThe combined weight of every item in a packing list, added up one item at a time inside a loop.PHP · Putting it togetherNew idea: a variable before a loop can carry a running totalOpen exercise →
- Trip SummaryHardA trip packing summary that reads a traveler's name from input, walks a list of item weights, flags anything over a limit, and prints a formatted total — combining everything from the earlier exercises into one program.PHP · A complete programNew idea: assembling a complete program from parts you already knowOpen exercise →
- Hello, Out LoudIntroA banner with your own name inside it, printed by code you ran yourself.Python · OutputNew idea: print() puts text on the screenOpen exercise →
- Name TagIntroA bordered name-tag card with your own name across three of its lines, every one of them fed by a single line of code.Python · VariablesNew idea: A variable is a reusable name for a valueOpen exercise →
- Party PlannerIntroA pizza order summary that works itself out from the guest list — slices needed, whole pizzas, and the slices that spill past them.Python · ArithmeticNew idea: Python does arithmetic with + - * // and %Open exercise →
- Umbrella or NotIntroA rain report card that reads the forecast for you and signs off with a straight answer — take the umbrella, or leave it at home.Python · ConditionsNew idea: if/else chooses between two different outcomesOpen exercise →
- CountdownIntroA launch sequence that counts itself down from five, then prints a liftoff banner and a small rocket.Python · LoopsNew idea: A for loop with range() repeats an actionOpen exercise →
- The Clapping GameIntroA count from one to twenty where every third number is replaced by a clap, so the beat is visible straight down the screen.Python · Loops and conditionsNew idea: An if inside a for loop, decided again on every passOpen exercise →
- The ScoreboardEasyA game scoreboard where every name, score and bar lands in the same column, built from one line of text with the values sitting inside it.Python · Strings and formattingNew idea: f-strings build text with values inside itOpen exercise →
- Packing ListEasyA travel packing checklist with a banner, one tick-box line for every item you put on the list, and a footer that counts them for you.Python · ListsNew idea: A list holds several values in order, and a for loop walks through themOpen exercise →
- Rainfall WeekMediumA seven-day rainfall chart with a row for every day, the week added up underneath it, and the wettest of the seven days picked out.Python · Putting it togetherNew idea: A variable made before a loop carries a running total from pass to passOpen exercise →
- The Cafe TicketHardA printed cafe receipt with the shop name at the top, three item rows in straight columns, a subtotal, a service charge the program works out itself, a total, and a thank-you line at the bottom.Python · A complete programNew idea: Assembling a complete program from parts you already knowOpen exercise →
- Say Hello with cat()IntroA tiny script that prints two lines of welcome text to the console.R · A complete programNew idea: Printing text with cat()Open exercise →
- Greet a Learner by NameIntroA one-line personalized greeting built from a value stored in a variable.R · VariablesNew idea: Assigning values with <-Open exercise →
- Add Up Two PricesIntroA small script that adds two prices together and prints the total.R · Numbers and arithmeticNew idea: Arithmetic operators (+, -, *, /)Open exercise →
- Check the TemperatureEasyA short program that checks a temperature and prints whether it counts as a hot day.R · ConditionalsNew idea: if / else branchingOpen exercise →
- Format an Order LineEasyA program that builds one clean, formatted sentence out of separate pieces of text and numbers.R · String formattingNew idea: Building formatted strings with paste0()Open exercise →
- Count from One to FiveEasyA short program that prints the numbers 1 through 5, one per line, using a loop.R · LoopsNew idea: for loops over a numeric range (1:n)Open exercise →
- Read Values from a VectorMediumA program that stores several temperature readings in one vector and prints specific ones by position.R · CollectionsNew idea: Vectors with c() and 1-based indexingOpen exercise →
- Loop Over a Price ListMediumA program that prints every price in a list, one per line, alongside its position.R · Loops and collectionsNew idea: Looping over a vector with length()Open exercise →
- Total the DonationsMediumA program that adds up a list of donation amounts using a loop and prints the grand total.R · AccumulationNew idea: Accumulating a running total in a loopOpen exercise →
- Build a Grade ReportHardA small grade report that labels each score as Pass or Fail and prints the class average, using everything from earlier exercises together.R · Putting it all togetherNew idea: Combining loops, conditionals, a vector, and formatted output in one programOpen exercise →
- Hello, Out LoudIntroA banner with your own name inside it, printed by code you ran yourself.Ruby · OutputNew idea: puts prints text followed by one newlineOpen exercise →
- Name TagIntroA conference name tag that prints a person's name and role from two variables, instead of typed-in text.Ruby · VariablesNew idea: A variable stores a value, and #{...} drops it into a stringOpen exercise →
- Party PlannerIntroA pizza order summary that works itself out from a guest list — slices needed, whole pizzas, and the slices left over.Ruby · ArithmeticNew idea: Integer division truncates with /, and % gives the remainderOpen exercise →
- Umbrella or NotIntroA weather forecast that prints one of three different messages, decided automatically from a single number.Ruby · ConditionsNew idea: if / elsif / else chooses between several outcomesOpen exercise →
- CountdownIntroA rocket countdown that prints every number from 5 down to 1, then announces liftoff.Ruby · LoopsNew idea: downto repeats a block once for every number in a falling rangeOpen exercise →
- The Clapping GameIntroA counting game from 1 to 10 that claps instead of saying any multiple of three out loud.Ruby · Loops and conditionsNew idea: an if inside a loop is decided again on every passOpen exercise →
- The ScoreboardEasyA game scoreboard where every name, score and bar lands in the same column, no matter how long the name or how many digits the score has.Ruby · Strings and formattingNew idea: ljust and rjust pad a string to a fixed width so columns line upOpen exercise →
- Packing ListEasyA travel packing checklist with a tick-box line for every item on the list, and a footer that counts them for you.Ruby · ArraysNew idea: An array holds several values in order, and each walks through themOpen exercise →
- Rainfall WeekMediumA seven-day rainfall report with a line for every day, the week added up underneath it, and the single wettest day picked out.Ruby · Putting it togetherNew idea: a variable created before a loop carries a running total from pass to passOpen exercise →
- The Bike Rental ReceiptHardA printed bike-rental receipt with a header, three rental rows in straight columns, a subtotal, a weekend surcharge the program works out itself, a total, and a couple of closing notes.Ruby · A complete programNew idea: Assembling a complete program out of parts you already knowOpen exercise →
- Your First SELECTIntroA tidy two-column listing of a tool library's shelves, produced by a query you narrowed down yourself, running against a real database inside your browser.SQL · Reading a tableNew idea: SELECT names the columns you want backOpen exercise →
- Pick the Right RowsEasyA shortlist of the cheap garden tools in a lending library, produced by tightening one condition in a WHERE clause that currently returns most of the table.SQL · Filtering with WHERENew idea: AND narrows a filter while OR widens itOpen exercise →
- The Dearest ThreeEasyA top-three listing of the highest deposits in a lending library, in a deliberate order rather than whatever order the rows came out in.SQL · Sorting and limitingNew idea: ORDER BY is what makes LIMIT mean anythingOpen exercise →
- Tools per ShelfEasyA per-shelf stocktake of a lending library — how many tools and how much deposit each shelf holds — with the one-tool shelves left out.SQL · Aggregates and groupingNew idea: GROUP BY splits an aggregate into one answer per group, and HAVING filters those groupsOpen exercise →
- Name the ToolEasyA readable loan register for a tool library — who borrowed what, from which shelf, and when — built from three separate tables that each hold one part of the answer.SQL · JoinsNew idea: JOIN ... ON pairs rows from two tables by a matching columnOpen exercise →
- Nobody Left OutEasyA loans-per-member summary that includes the member who has never borrowed anything, showing her a truthful zero.SQL · JoinsNew idea: LEFT JOIN keeps unmatched rows, and count(*) then miscounts themOpen exercise →
- Above the AverageMediumA shortlist of the tool library's heaviest borrowers — the members whose total deposit value is above the average across all members — computed in two named steps.SQL · Subqueries and CTEsNew idea: A CTE names an intermediate result so a later step can use itOpen exercise →
- The Missing WHEREMediumA corrected price list for a tool library, where exactly one deposit was changed and the other four were left alone, wrapped in a transaction and checked before and after.SQL · Changing dataNew idea: UPDATE without WHERE changes every row, and a transaction is what makes a mistake undoableOpen exercise →
- The Running TotalMediumA loan ledger where each row shows both its own deposit and the total taken in up to and including that day — the shape every bank statement and sales dashboard uses.SQL · Window functionsNew idea: ORDER BY inside OVER turns an aggregate into a running oneOpen exercise →
- Two per ShelfHardA per-shelf leaderboard of a tool library's two dearest tools on each shelf — the top-N-per-group query that people learn window functions in order to write.SQL · Window functionsNew idea: PARTITION BY restarts a window function's numbering for each groupOpen exercise →
- Checked, Then RunIntroA five-line card with your own name on it, printed by TypeScript you ran yourself once the compiler had checked it.TypeScript · OutputNew idea: console.log() puts text on the screenOpen exercise →
- Luggage TagIntroA luggage tag carrying your own name on three of its lines, all three fed by one value you typed once at the top.TypeScript · VariablesNew idea: const gives a value a name you can use againOpen exercise →
- Egg BoxesIntroA farm report that works out its own egg count from the hens, then the full boxes that count fills and the eggs left over.TypeScript · ArithmeticNew idea: numbers do arithmetic, and Math.floor and % split a count into whole groups and a remainderOpen exercise →
- The Ticket MachineIntroA bus ticket summary that adds up the riders and works out the fare, once you have fixed the one value the compiler refused to accept.TypeScript · TypesNew idea: a type annotation such as : number says what a name must hold, and a value that does not match stops the program before it runsOpen exercise →
- The Fern CheckIntroA plant check that compares today's soil moisture with a dry mark, prints the true-or-false answer, and ends on one of two instructions.TypeScript · ConditionsNew idea: a boolean is true or false, and if/else runs one of two blocks depending on itOpen exercise →
- Parcel PostageIntroA postage price list where every price comes from one function, called once per parcel with a weight and a rate.TypeScript · FunctionsNew idea: a function takes typed parameters and returns a typed resultOpen exercise →
- The League TableEasyA league table whose team names, games played and points all sit in straight columns, every row built by the one function you rewrote.TypeScript · Strings and formattingNew idea: template literals build text with values inside itOpen exercise →
- The Number 12 BusEasyA bus route card with one line for every stop in the array, and a footer that counts the stops without being told how many there are.TypeScript · ArraysNew idea: an array type such as string[] holds several values of one type, and for...of walks through themOpen exercise →
- The Departure BoardMediumA station departure board showing the destination, platform and wait for every train, built from objects that all match one Train type.TypeScript · Object typesNew idea: an object type lists the properties an object must have, and the compiler checks every object against itOpen exercise →
- The Bike Shop ReceiptHardA printed bike repair receipt: the shop name, three charges in straight columns, a subtotal, a workshop charge the program works out itself, a total, and the notes at the bottom.TypeScript · A complete programNew idea: assembling a complete program out of parts you already knowOpen exercise →
Graded problems
24 shownInterview-style challenges with visible examples, additional checks and complexity targets.
- Balanced ParenthesesEasyThe input line has between 0 and 10,000 characters.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Best Contiguous RunEasyThe input line has at least 1 and at most 100,000 integers.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Binary SearchEasyThe array has at least 1 integer and at most 100,000 integers.Python · Data structures and algorithmsTarget O(log n)Solve problem →
- Binary Tree Level Order SumEasyThe tree is given as an array of 1 to 1,000 entries, position 0 being the root.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Class Average To Two DecimalsEasyThe first line is n, the number of scores, with 1 <= n <= 10,000.Python · Debugging labsTarget O(n)Solve problem →
- Count The Target TicketEasyThe first line holds between 1 and 20,000 ticket numbers separated by single spaces.Python · JavaScript · Debugging labsTarget O(n)Solve problem →
- Cycle in a Sequence ChainMediumThe chain has between 1 and 100,000 nodes, indexed 0 to n - 1.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Fewest Coins for AmountHardThere are between 1 and 50 coin denominations, each a distinct positive integer between 1 and 10,000.Python · Data structures and algorithmsTarget O(amount * k)Solve problem →
- Group Word ClustersEasyThe input has at least 1 and at most 500 words.Python · Data structures and algorithmsTarget O(n * k log k)Solve problem →
- Largest Gap Between ReadingsEasyThe first line is n, the number of readings, with 2 <= n <= 50,000.Python · Debugging labsTarget O(n)Solve problem →
- Long Words Per LineHardThe first line holds two integers separated by a single space: t, the number of word lines that follow (1 <= t <= 50), and k, the minimum length (1 <= k <= 20).Python · Debugging labsTarget O(w)Solve problem →
- Longest Stretch Without a RepeatMediumThe input line contains only lowercase English letters (a-z) and may be empty.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Longest Win StreakMediumThe first line is t, the number of teams, with 1 <= t <= 200.Python · Debugging labsTarget O(c)Solve problem →
- Lowest Reading Of The DayEasyThe input is one line of between 1 and 50,000 integers separated by single spaces.Python · JavaScript · Debugging labsTarget O(n)Solve problem →
- Merge Overlapping BookingsMediumThe input has at least 1 and at most 2,000 intervals.Python · Data structures and algorithmsTarget O(n log n)Solve problem →
- Nth Fibonacci Number (Memoized)Medium0 <= n <= 35Python · Data structures and algorithmsTarget O(n)Solve problem →
- Reverse Words in a StringEasyThe input line has length at most 10,000 characters.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Shortest Hop CountHardThe graph has between 1 and 100,000 nodes, numbered 0 to n - 1, and between 0 and 200,000 edges.Python · Data structures and algorithmsTarget O(n + m)Solve problem →
- Strictly Increasing CheckMediumThe first line is t, the number of sequences, with 1 <= t <= 200.Python · Debugging labsTarget O(v)Solve problem →
- Top Three ScoresMediumThe first line is n, the number of scores, with 3 <= n <= 20,000.Python · JavaScript · Debugging labsTarget O(n log n)Solve problem →
- Two Number SumEasyThe array has at least 2 integers.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Valid PalindromeEasyThe input line has between 0 and 1,000 characters.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Warmer Day CountdownMediumThe input line has at least 1 and at most 100,000 integers.Python · Data structures and algorithmsTarget O(n)Solve problem →
- Widest Water TankMediumThe input line has at least 2 and at most 100,000 non-negative integers.Python · Data structures and algorithmsTarget O(n)Solve problem →
Practise one language, start to finish
Each language with an exercise path also has a practice hub: its exercises, graded problems, lessons, cheat sheet and playground on one page.
Questions about the practice problems
- What does 'hidden test cases' actually mean here?
- Each problem is graded against tests you can see (the samples) and tests you cannot (the hidden ones), so a solution that only fits the samples fails. Because the site has no server, 'hidden' means not shown on the page and fetched only when you press Submit — a determined person can find them in the browser's network tab. They exist to make the feedback honest, not to stop cheating.
- Which language can I solve the problems in?
- Whichever the problem lists, and most are Python-only today. A handful of the debugging-lab problems also accept JavaScript, and each problem page shows a language picker above the editor when more than one is offered. The problem statements are language-independent, so you can always solve one in any language on your own computer even when in-page grading does not yet run it.
- Are these the exact questions companies ask in interviews?
- No, and no site can honestly claim that. These are classic problem shapes — pairs that sum to a target, balanced brackets, binary search — chosen because of what they teach about data structures and complexity, which is what interviews test.
- How should a beginner start practicing coding problems?
- Start with Easy problems in a language whose variables, loops and functions you already understand. Work on one topic at a time, write down the input and expected output before coding, and run the visible examples first. If the statement itself is confusing, return to the small language exercises before attempting more interview-style problems.
- Do I need to study data structures and algorithms before solving problems?
- You can begin with basic logic and arrays, then learn each data structure when a problem gives you a reason to need it. The problem pages link to plain-English concept guides, complexity targets and related terms, so practice and theory can grow together rather than becoming two separate courses.
- Is the coding practice free and does it require an account?
- It is free and does not require an account. Solutions run locally in your browser, and completed problems are recorded only in that browser. You can export the progress file yourself if you want a backup or need to move it to another device.
The ideas behind the problems
Every term a problem leans on — hash table, two pointers, time complexity — is defined in plain English with a small example in the programming glossary. Some problems accept more than one language: each problem page says which, and the picker sits above the editor. Anything you want to try outside a problem belongs in a playground.