- By Rowan Lea
- ·
- Posted Jan 25, 2024 10:21:11 AM
Songbird
Inspired by the creative works of Gawain Hewitt: https://gawainhewitt.co.uk/
Santa wants to increase the number of Christmas trees that he has in his allotment.
Santa wants to plant n evergreen Christmas trees in his allotment.
His allotment is always a square of n plots by n plots.
One plot may contain a Christmas tree.
However, because of their magical root structure these evergreen trees will not grow if there is another one horizontally, vertically or diagonally aligned with the tree.
For example, given n = 4 and if we represent a tree with O and an empty lot with - (dash), then there is 1 valid output and 3 invalid.
Given a size n, try to find a valid solution for placing the trees in an allotment size of n. If there is no valid solution, then return an empty array.
So, if n = 4, we can fit 4 Christmas trees on a 4 x 4 grid (see examples below).
However, n = 2, we cannot fit 2 trees onto a 2 x 2 grid following these rules, so we would return the empty array.
Inspired by the creative works of Gawain Hewitt: https://gawainhewitt.co.uk/
What do we want to build? We are building a shopping cart for an online grocery shop. The idea of this kata is to build the product in an iterative..
Iteration 1 Business rules We want to build an ATM machine and the first thing we need to do, is to create the software that will breakdown which..
Join our newsletter for expert tips and inspirational case studies
Join our newsletter for expert tips and inspirational case studies