Editorial for Valentine's Day '19 J4 - Flowers

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

The intended solution was to iterate over all permutations. A 2d array can be used to check whether or not two flowers can be used together. Remember that it may not be possible to have three distinct flowers in a bouquet.

Time Complexity: \mathcal{O}(N^3)


There are no comments at the moment.