Solution for https://www.hackerrank.com/challenges/flowers