15 fun coding problems from easy to hard, each with the core idea behind the solution and where to practice it. A 2026 guide for developers.
Every developer hits the same wall: tutorials make sense while you watch them, then a blank editor makes everything disappear. The fix is not another video. It is solving real problems, one at a time, until the patterns stick. The list below collects 15 fun coding problems from easy to hard, each with a short description, the core idea behind the solution, and a link to a place where you can solve it and check your work.
We pulled this set from the kinds of problems developers actually share and discuss on daily.dev and across the wider community, ordered so you can start wherever your comfort level is and climb. Skim the table, pick one that looks slightly harder than what you can do today, and write the code before you read the approach.
| # | Problem | Difficulty | Core skill |
|---|---|---|---|
| 1 | FizzBuzz | Easy | Conditionals, modulo |
| 2 | Palindrome checker | Easy | Strings, two pointers |
| 3 | Fibonacci sequence | Easy | Recursion, memoization |
| 4 | Two Sum | Easy | Hash maps |
| 5 | Roman to integer | Intermediate | Mapping, iteration |
| 6 | Rotate an array | Intermediate | In-place manipulation |
| 7 | Find the missing number | Intermediate | Math, bit tricks |
| 8 | Validate a binary search tree | Intermediate | Tree traversal |
| 9 | Sudoku solver | Advanced | Backtracking |
| 10 | N-Queens | Advanced | Backtracking, pruning |
| 11 | Lowest common ancestor | Advanced | Tree recursion |
| 12 | Serialize and deserialize a tree | Advanced | Traversal, encoding |
| 13 | Topological sort | Expert | Graphs, ordering |
| 14 | Regular expression matching | Expert | Dynamic programming |
| 15 | Alien dictionary | Expert | Graphs, topological sort |
1. FizzBuzz
Print the numbers 1 to 100, but replace multiples of three with "Fizz", multiples of five with "Buzz", and multiples of both with "FizzBuzz". It sounds trivial, and it is, which is exactly why it is the classic interview warm-up: it checks whether you can translate a few simple rules into clean control flow without overthinking it.
The trap is order. Check the both-divisible case first, or build the output string by appending "Fizz" and "Buzz" and printing the number only when the string is empty. Either approach works; the second scales better when someone adds a third rule.
2. Palindrome checker
Decide whether a string reads the same forwards and backwards, ignoring case and non-alphanumeric characters. "A man, a plan, a canal: Panama" should return true.
The clean solution walks two pointers inward from both ends, skipping anything that is not a letter or digit. It runs in linear time with constant extra space, which is a good habit to build early: reach for two pointers before you reach for a reversed copy of the string.
3. Fibonacci sequence
Return the nth Fibonacci number. The naive recursive version is a great teaching tool precisely because it is slow: it recomputes the same values exponentially. Add memoization and the same code drops to linear time.
This is the cheapest way to feel what dynamic programming is for. If you understand why caching the subresults turns an exponential problem into a linear one, several harder problems on this list will feel familiar.
4. Two Sum
Given an array of integers and a target, return the indices of the two numbers that add up to the target. The brute-force answer checks every pair in quadratic time. The better answer stores each number you have seen in a hash map and asks, for each new number, whether its complement is already there.
It is the canonical example of trading space for speed, and the hash-map move it teaches shows up in dozens of harder problems.
5. Roman to integer
Convert a Roman numeral string like "MCMXCIV" into its integer value. The rule that makes it interesting: a smaller numeral before a larger one means subtraction, so "IV" is four, not six.
Iterate left to right, and subtract the current value instead of adding it whenever it is smaller than the value to its right. It is a tidy lesson in reading ahead by one element while you scan.
6. Rotate an array
Shift every element of an array k positions to the right, wrapping around. The obvious solution uses a second array. The elegant one reverses the whole array, then reverses the first k elements and the rest separately, rotating in place with constant extra space.
The reversal trick feels like sleight of hand the first time you see it. Work through it on paper with a five-element array and it becomes obvious why it works.
7. Find the missing number
You have the numbers 0 to n with exactly one missing. Find it. You can sum the full range with the arithmetic formula and subtract the sum of what you actually have. Or you can XOR everything together, which cancels out every number that appears twice and leaves the missing one.
Two valid approaches with different trade-offs is the real lesson here: there is rarely one correct answer, only ones with different costs.
8. Validate a binary search tree
Check whether a binary tree obeys the search-tree property: every node larger than everything in its left subtree and smaller than everything in its right. The common mistake is to compare each node only with its direct children, which misses violations deeper down.
The fix is to pass down a valid range as you recurse, narrowing it at each step. It is the problem that teaches you to carry context through a tree traversal rather than judging each node in isolation.
9. Sudoku solver
Fill a partially completed 9x9 grid so every row, column, and 3x3 box contains the digits 1 through 9. This is your introduction to backtracking: try a digit, recurse, and if you hit a dead end, undo the choice and try the next one.
It is genuinely satisfying to watch a correct backtracking solution fill the grid. Once it clicks, the next two problems on this list will feel like variations on a theme you already know.
10. N-Queens
Place N queens on an N-by-N chessboard so none can attack another. It is backtracking again, but with smarter pruning: track which columns and diagonals are already threatened so you never explore a placement that cannot work.
The difference between a solution that times out and one that is fast is entirely in the pruning. That lesson, prune early and aggressively, carries through most hard search problems.
11. Lowest common ancestor
Given two nodes in a binary tree, find their lowest shared ancestor. The recursive solution is short and beautiful: search both subtrees, and the node where the two searches meet is your answer.
It rewards you for trusting recursion instead of fighting it. If you find yourself writing loops and parent pointers, step back and let the recursion do the bookkeeping.
12. Serialize and deserialize a tree
Turn a binary tree into a string, then rebuild the identical tree from that string. It is the problem behind every "save this data structure to a file" feature you will ever write.
The key insight is that a single traversal, with explicit markers for null children, captures enough structure to reconstruct the tree exactly. Pick a traversal, be consistent, and the rebuild falls out naturally.
13. Topological sort
Given tasks with dependencies, produce an order in which every task comes after the ones it depends on. It is the engine behind build systems, package managers, and course-prerequisite planners.
You can solve it by repeatedly removing nodes with no remaining dependencies, or with a depth-first traversal that records nodes as it finishes them. Either way, if the graph has a cycle, there is no valid order, and detecting that cycle is half the problem.
14. Regular expression matching
Implement a small regex engine that supports "." for any character and "*" for zero or more of the preceding element. It is one of the cleaner dynamic-programming problems once you frame it as a grid: does the first i characters of the text match the first j characters of the pattern?
Getting the "*" case right, where it can match nothing or extend a match, is the whole challenge. Solve this and the dynamic-programming muscle you built on Fibonacci is now doing real work.
15. Alien dictionary
You are given words sorted by the rules of an unknown alphabet. Recover the order of the letters. It is the boss level of this list because it combines two earlier skills: derive the ordering constraints by comparing adjacent words, then run a topological sort on those constraints.
When you can take a vague, story-shaped problem and recognize the graph hiding inside it, you have crossed from solving problems to seeing them, which is the whole point of practicing.
How to practice these well
Solving a problem once teaches you less than you think. The developers who improve fastest practice deliberately. They write the solution before reading the approach, even a broken one, because the struggle is where the learning lives. They come back to the same problem a week later and solve it from scratch. And they explain it out loud, which has a way of exposing the parts you only half understand.
A few good homes for this kind of deliberate practice: LeetCode for interview-style problems with test cases, Codewars for bite-sized katas you can rank up through, Exercism for problems paired with human mentorship, and Project Euler when you want math-flavored challenges that reward clever thinking over raw code. If you want to keep a pulse on what other developers are building and discussing while you practice, the daily.dev feed surfaces the articles, tools, and conversations that keep the patterns fresh.
FAQs
What are good coding problems for beginners?
Start with problems that test one idea at a time: FizzBuzz for control flow, a palindrome checker for string handling, and the Fibonacci sequence for recursion. They are short enough to finish in one sitting and they build the habits the harder problems assume you already have. Our guide to how to start learning to code from scratch is a good companion if you are early in the journey.
How many coding problems should I solve a day?
Two or three solved well beats ten rushed. A developer who solves three problems and can re-solve them from memory next week has learned more than one who skims twenty. Consistency over weeks matters far more than any single day.
Are these problems useful for technical interviews?
Yes. Two Sum, validate a binary search tree, the backtracking problems, and regular expression matching are all close cousins of common interview questions. More importantly, the patterns they teach, hash maps, two pointers, backtracking, dynamic programming, and graph traversal, cover most of what interviewers are actually probing for.
Where can I discuss coding problems with other developers?
Programming communities are the fastest way to get unstuck and to see approaches you would not have found alone. See our roundup of the best programming forums in 2026 and the broader programming communities worth joining for active places to share solutions and ask questions.
Final thoughts
Fun coding problems are not busywork. Each one on this list isolates a skill, hash maps, recursion, backtracking, dynamic programming, graphs, that you will reuse for the rest of your career. Work through them in order, re-solve the ones that fought back, and you will feel the gap between watching tutorials and actually building close fast.
Pick number one, open your editor, and write the first line before you read another word. To keep new problems, tools, and discussions in front of you while you practice, follow along on daily.dev.