Search
⌘K

Leetcode 1042. Flower Planting With No Adjacent

Color the vertices of an undirected graph (n gardens, edges given by paths) with one of 4 flower types so that adjacent vertices have different types; since each garden has degree at most 3, a proper 4-coloring is always possible and can be found greedily.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.