Coding challenges
LeaderboardStart with the basics or work through classic problems. Solve each one in any of 20 languages: Run checks your code on the examples, and Submit checks it against every test.
Daily challenge · Saturday 21 November
Work out an arithmetic expression written in postfix order.
Study lists
All lists- Programming basicsYour first 14 programs: read the input, work something out, print the answer.14 challenges
- Easy problems, step by stepAll 25 easy problems, in an order where each one builds on the last.25 challenges
- Interview essentials43 classics that cover the patterns interviews ask about most, grouped by pattern.43 challenges
- Dynamic programming from zeroTen problems that build up dynamic programming, from climbing stairs to pattern matching.10 challenges
All challenges
Challenges
75
Easy
39
Medium
24
Hard
12
Sign in to submit solutions, save challenges and keep track of what you’ve solved.
75 of 75
| Status | Challenge | Topics | Level | Accepted | Save |
|---|---|---|---|---|---|
| Say helloRead a name and greet that person. | BasicsStrings | Easy | 100% | ||
| Sum of two numbersRead two whole numbers and print their sum. | BasicsMath | Easy | 100% | ||
| Even or oddSay whether a whole number is even or odd. | BasicsMath | Easy | 100% | ||
| Largest of threePrint the largest of three numbers. | Basics | Easy | 100% | ||
| Leap yearDecide whether a year is a leap year. | BasicsMath | Easy | 100% | ||
| Celsius to FahrenheitConvert a temperature from Celsius to Fahrenheit. | BasicsMath | Easy | – | ||
| Grade from scoreTurn a test score into a letter grade. | Basics | Easy | – | ||
| FizzBuzzCount to n, saying Fizz, Buzz or FizzBuzz for multiples of 3 and 5. | BasicsMath | Easy | – | ||
| Multiplication tablePrint the times table of a number from 1 to 10. | Basics | Easy | – | ||
| Right triangleDraw a triangle of stars, one more on each line. | Basics | Easy | – | ||
| Sum of a listRead a list of numbers and print their total. | BasicsArrays | Easy | – | ||
| Count the vowelsCount how many vowels a line of text has. | BasicsStrings | Easy | – | ||
| Reverse a linePrint a line of text backwards. | BasicsStrings | Easy | – | ||
| Count the wordsCount the words in a line of text. | BasicsStrings | Easy | – | ||
| Two SumFind the two positions whose numbers add up to a target. | ArraysHash maps | Easy | 100% | ||
| Valid PalindromeCheck whether text reads the same both ways, ignoring case and punctuation. | StringsTwo pointers | Easy | – | ||
| Palindrome NumberCheck whether a number's digits read the same both ways. | Math | Easy | – | ||
| Valid ParenthesesCheck that every bracket is closed by the right kind, in the right order. | StringsStacks | Easy | – | ||
| Merge Sorted ArraysMerge two sorted arrays into one sorted array. | ArraysTwo pointersSorting | Easy | – | ||
| Best Time to TradePick one day to buy and a later day to sell for the biggest profit. | ArraysGreedy | Easy | – | ||
| Contains DuplicateCheck whether any number appears twice. | ArraysHash maps | Easy | – | ||
| Valid AnagramCheck whether one word is a rearrangement of another. | StringsHash mapsSorting | Easy | – | ||
| Missing NumberFind the one number missing from 0 to n. | ArraysMathBit manipulation | Easy | – | ||
| Single NumberEvery number appears twice except one; find it. | ArraysBit manipulationHash maps | Easy | – | ||
| Move ZerosMove every zero to the end, keeping the other numbers in order. | ArraysTwo pointers | Easy | – | ||
| Binary SearchFind a number's position in a sorted array in log time. | ArraysBinary search | Easy | – | ||
| Climbing StairsCount the ways to climb n stairs taking one or two at a time. | Dynamic programmingMathRecursion | Easy | – | ||
| Majority ElementFind the value that fills more than half of the array. | ArraysHash maps | Easy | – | ||
| Roman to IntegerTurn a Roman numeral into a number. | StringsMathHash maps | Easy | – | ||
| Longest Common PrefixFind the longest start that every word shares. | Strings | Easy | – | ||
| Count Set BitsCount the 1s in a number's binary form. | Bit manipulationMath | Easy | – | ||
| Plus OneAdd one to a number stored as an array of digits. | ArraysMath | Easy | – | ||
| First Unique CharacterFind the first letter that appears only once. | StringsHash maps | Easy | – | ||
| Squares of a Sorted ArraySquare every number of a sorted array and keep it sorted. | ArraysTwo pointersSorting | Easy | – | ||
| Longest Substring Without RepeatsFind the longest stretch of text with no repeated character. | StringsSliding windowHash maps | Medium | – | ||
| Product Except SelfFor each position, multiply every other number, without dividing. | Arrays | Medium | – | ||
| Maximum SubarrayFind the largest sum of a run of consecutive numbers. | ArraysDynamic programmingGreedy | Medium | – | ||
| Top K FrequentReturn the k values that appear most often. | ArraysHash mapsSorting | Medium | – | ||
| Three SumFind every distinct triple of numbers that adds up to zero. | ArraysTwo pointersSorting | Medium | – | ||
| Container With Most WaterPick two walls that hold the most water between them. | ArraysTwo pointersGreedy | Medium | – | ||
| Rotate MatrixTurn a square grid of numbers 90 degrees clockwise. | MatricesArrays | Medium | – | ||
| Spiral MatrixRead a grid in a clockwise spiral from the outside in. | MatricesArrays | Medium | – | ||
| Number of IslandsCount the separate islands of land on a grid map. | GraphsMatrices | Medium | – | ||
| Coin ChangeMake an amount with as few coins as possible. | Dynamic programming | Medium | – | ||
| Longest Increasing SubsequenceFind the longest strictly rising sequence you can pick out of an array. | Dynamic programmingBinary search | Medium | – | ||
| Search in a Rotated ArrayBinary-search a sorted array that has been rotated. | ArraysBinary search | Medium | – | ||
| Merge IntervalsMerge every pair of overlapping intervals. | ArraysSorting | Medium | – | ||
| Days Until WarmerFor each day, count the days until a warmer one. | ArraysStacks | Medium | – | ||
| House RobberTake the most from a row of houses without taking two neighbours. | Dynamic programming | Medium | – | ||
| Jump GameDecide whether you can jump from the first square to the last. | ArraysGreedyDynamic programming | Medium | – | ||
| Unique PathsCount the paths across a grid moving only right or down. | Dynamic programmingMathMatrices | Medium | – | ||
| Subarray Sum Equals KCount the runs of consecutive numbers that add up to k. | ArraysHash maps | Medium | – | ||
| Generate ParenthesesList every balanced string of n pairs of parentheses. | RecursionStrings | Medium | – | ||
| Evaluate Reverse Polish NotationWork out an arithmetic expression written in postfix order. | StacksMath | Medium | 100% | ||
| Trapping Rain WaterWork out how much rain water a skyline of bars holds. | ArraysTwo pointersStacks | Hard | – | ||
| Median of Two Sorted ArraysFind the median of two sorted arrays taken together. | ArraysBinary search | Hard | – | ||
| Edit DistanceCount the fewest single-letter edits that turn one word into another. | StringsDynamic programming | Hard | – | ||
| Longest Valid ParenthesesFind the longest balanced run in a string of parentheses. | StringsStacksDynamic programming | Hard | – | ||
| Largest Rectangle in a HistogramFind the biggest rectangle that fits under a bar chart. | ArraysStacks | Hard | – | ||
| Sliding Window MaximumReport the largest number in every window of k as it slides along. | ArraysSliding window | Hard | – | ||
| Minimum Window SubstringFind the shortest stretch of text that contains every letter of another string. | StringsSliding windowHash maps | Hard | – | ||
| N QueensCount the ways to place n queens on an n × n board with none attacking another. | Recursion | Hard | – | ||
| Word LadderFind the shortest chain of one-letter changes from one word to another. | GraphsStringsHash maps | Hard | – | ||
| Pattern MatchingMatch text against a pattern with . and * wildcards. | StringsDynamic programmingRecursion | Hard | – | ||
| Reverse a Linked ListTurn a linked list around so its last node comes first. | Linked lists | Easy | – | ||
| Merge Two Sorted ListsJoin two sorted linked lists into one sorted list. | Linked listsTwo pointers | Easy | – | ||
| Middle of a Linked ListFind the middle node of a linked list in one pass. | Linked listsTwo pointers | Easy | – | ||
| Depth of a TreeCount the levels of a binary tree, from the root to its deepest leaf. | TreesRecursion | Easy | – | ||
| Invert a TreeMirror a binary tree, swapping every node's left and right children. | TreesRecursion | Easy | – | ||
| Remove the Nth Node From the EndUnlink the node n places from the end of a linked list. | Linked listsTwo pointers | Medium | – | ||
| Add Two Numbers in ListsAdd two numbers stored digit by digit in linked lists. | Linked listsMath | Medium | – | ||
| Tree Level by LevelList a binary tree's values one level at a time, left to right. | TreesGraphs | Medium | – | ||
| Valid Search TreeCheck whether a binary tree keeps the search tree order everywhere. | TreesRecursion | Medium | – | ||
| Reverse in Groups of kReverse a linked list k nodes at a time, leaving a short last group as it is. | Linked lists | Hard | – | ||
| Best Path Sum in a TreeFind the path through a binary tree whose values add up to the most. | TreesRecursionDynamic programming | Hard | – |