Solved LeetCode program · 805 of 1,000
#1042 · Flower Planting With No Adjacent
Original English source
The firsts is a list of 0 and 2. The seconds is a list of 1 and 3. The count is 4. The colors is a list of 0, 0, 0, and 0.
For every garden from 0 to count minus 1.
The used is an empty list of whole numbers.
For every edge from 0 to the last position of firsts.
The other is -1. If item edge of firsts is garden, set other to item edge of seconds. If item edge of seconds is garden, set other to item edge of firsts. If other is at least 0, The shade is item other of colors, Place shade into used.
For every choice from 1 to 4.
If used does not contain choice, set item garden of colors to choice, stop.
For each value in colors, Show value.
Expected stdout
1 2 1 2