Coding Katas
Overview
What is a Coding Kata?
A coding kata is a small, self-contained programming problem designed to help you practice and improve your skills. The term "kata" comes from martial arts—a choreographed pattern of movements repeated to build muscle memory and improve technique.
In software development, a kata serves a similar purpose:
- Clear problem statement: No ambiguity about what needs solving
- Appropriate difficulty: Challenging but not overwhelming
- Repetition: Solve the same kata in different languages, or with different approaches (TDD, functional, imperative, etc.)
- Feedback: You know immediately if your solution works
Katas are valuable for:
- Learning a new programming language quickly
- Practising Test-Driven Development (TDD)
- Exploring different algorithmic approaches
- Building problem-solving muscle memory
- Preparing for technical interviews
I've collected several katas that I use to teach junior developers and practise my own skills. Here are my favourites, ranging from simple to moderate difficulty.
CalcStats
Difficulty: Easy to Medium
Skills: Arrays, iteration, basic algorithms
Your task is to process a sequence of integer numbers to determine the following statistics:
- Minimum value
- Maximum value
- Number of elements in the sequence
- Average value
- Sum of all values
- Whether the total sum is an odd or even number
Why this kata: Teaches you how to iterate over collections and accumulate different types of data. Good for learning language idioms.
Learning opportunity: Try implementing this in a language you don't know. Better yet, use TDD—write the tests first, then implement the function.
Scrabble Score
Difficulty: Easy
Skills: String manipulation, dictionaries/maps, conditional logic
Given a word, compute the scrabble score for that word.
1Letter Values:
2
31 – A, E, I, O, U, L, N, R, S, T
42 – D, G
53 – B, C, M, P
64 – F, H, V, W, Y
75 – K
88 – J, X
910 – Q, Z
Example: The word "JavaScript" should return a score of 24.
Why this kata: Teaches character-by-character string processing and dictionary lookups. Common pattern in text processing.
Learning opportunity: Implement this in both uppercase and lowercase handling. Try functional programming approaches (map/filter/reduce).
Roman Numerals
Difficulty: Medium
Skills: Number conversion, algorithm design, string building
Task #1: Number to Roman Numerals
Write a function that converts an integer (up to a max value of 3,999) into Roman numerals.
1I = 1
2V = 5
3X = 10
4L = 50
5C = 100
6D = 500
7M = 1000
Examples:
- 2021 = MMXXI
- 3999 = MMMCMXCIX
Task #2 (Optional): Roman Numerals to Number
Write a function that converts Roman numeral strings back to their integer value.
Why this kata: Teaches you how to break down a complex problem into a clear algorithm. The key insight—that you need to handle both additive (I + V) and subtractive (IV, IX) patterns—makes this more interesting than it first appears.
Learning opportunity: Try this with TDD. First figure out what test cases you need, then implement the function.
Using These Katas
Getting Started
Pick one kata that interests you. It doesn't matter if you think it's too easy—the goal isn't to struggle, it's to build understanding.
Three Ways to Practice
1. Language Learning Pick a language you want to learn. Solve these katas in that language. You'll learn syntax, idioms, and how the language handles common patterns.
2. TDD Practice Write the tests first (before any implementation). This forces you to:
- Understand the problem completely
- Think about edge cases
- Build confidence in your solution
3. Algorithm Exploration Once you've solved it one way, try another:
- Solve it functionally instead of imperatively
- Solve it with different data structures
- Try to solve it with fewer lines of code
When to Use These
- Learning a new language: Great for getting familiar with syntax and standard library
- Preparing for interviews: Solve under time pressure to simulate interview conditions
- Mentoring: Give these to junior engineers to practice problem-solving
- Refreshing skills: Revisit them in a language you haven't used in a while
Going Further
Once you've mastered these, explore online kata platforms:
- CodeWars (codewars.com) - Thousands of katas, ranked by difficulty
- HackerRank (hackerrank.com) - Interview preparation focus
- LeetCode (leetcode.com) - Technical interview prep
Why Deliberate Practice Matters
Solving katas isn't just about the solution—it's about deliberate practice. You're focusing on specific skills in a low-stakes environment. This is how you improve faster than just writing production code.
Professional software development demands certain skills:
- Problem decomposition
- Pattern recognition
- Clean code habits
- Testing practices
Katas let you sharpen these without production pressure.
Challenge Yourself
I'd genuinely like to hear how these katas work for you. Which one did you find most interesting? Did you try a new language? Share your experience on LinkedIn or reach out directly.
And if you solve these katas, consider posting your solution on GitHub. Teaching others by sharing your approach is one of the best ways to solidify your own understanding.