Coding Kata Exercises
Coding Kata are simple problems you can solve using TDD techniques to help you practice unit testing and development with various platforms and languages as well as to “sharpen” you up for the day. Get the brain working. The fingers moving. You know. :-)
I’m compiling a list of Kata to practice with here. Give one a try:
- Convert Arabic Numbers to Roman Numerals
1 to 100.
- Fizz Buzz
If a number is divisible by 3 return “Fizz”. If it’s divisible by 5 return “Buzz”. If it’s divisible by both, return “FizzBuzz”.
Given a string such as “5+4*3”, calculate it. Order of operations should be observed.
- ROT13 Encoder
Encode a string with ROT13. (A is N, B is O, etc.)
- Logic Gates
Build a set of logic gates that can be combined to create large expression. (AND, OR, XOR, NOT)
Return a fibonacci sequence of any specified length. (1, 1, 2, 3, 5…)
- Prime Numbers
Create an isPrime() method.
- Time is Relative
Write a Facebook-style method that returns time qualitatively. If the difference between two timestamps is less than 5 seconds, return “Just moments ago.” If less than a minute, return “X seconds ago.” If less than an hour, return “X minutes ago.”
- A Better Array (iOS-specific)
Jazz up NSArray and NSMutableArray. Add methods such as firstObject, secondToLastObject, map (creates a new array from iterating each item of an existing), and reverse.