Suppose we have a 2 x n checkerboard (two rows and n columns).
Write the recursive method, dominos
, that, given n, returns
the number of possible ways in which we can cover the board with
1 x 2 dominos. For example:
|
n = 1 -> 1 |
|| --
n = 2 -> 2 || --
||| --| |--
n = 3 -> 3 ||| --| |--
If n is less than zero, throw an IllegalArgumentException
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: