solved Flowers algorithmic challenge from HackerRank